from itertools import permutations
A_list = []
for i in range(5):
    A = int(input())
    A_list.append(A)
nes = [0,1,2,3,4]
iterator = []
for i in permutations(nes):
    iterator.append(i)
min1 = 10**9
for i in iterator:
    temp = 0
    for j in i:
        if temp%10 != 0:
            temp += (10-temp%10)
        temp += A_list[j]
    if temp < min1:
        min1 = temp
print(temp)