 
import itertools
#import time

#t1 = time.time()

num = [int(input()) for _ in range(5)]
#num2 = [n if n % 10 == 0 else n - (n%10) + 10  for n in num]

N = []

for i in list(itertools.permutations(range(5))):
    c = 0
    n = 0
#    print(i)
    for j in i:
        c += 1
 #       print(j)
        if c == 5:
            n += num[j]
#            print(n)
        else:
            n += num[j] - (num[j] % 10) + 10
 #           print(n)
    N.append(n)

print(int(min(N)))

#t2 = time.time()

#print(t2-t1)
