a = [int(input())for i in range(5)]
ans = 0
min_a=10000
for i in a:
    if i%10==0:
        ans+=i
    else:
        ans+=(i//10+1)*10
        min_a = min(min_a, i%10)
    
    
print(ans-(10-min_a))
