L = [int(input()) for i in range(5)]
L1 = [x for x in L if x%10 ==0 ]
L2 = [x for x in L if x%10 !=0 ]
L3 = [x%10 for x in L2 ]

idx = L3.index(min(L3))
for i in range(len(L2)):
    if i != idx:
        L2[i] = (L2[i]//10+1)*10
if L1:
    a = sum(L1)
else:
    a =0
if L2:
    b = sum(L2)
else:
    b = 0
print(a+b)