ts = [int(input()) for _ in range(5)]
a = [t % 10 for t in ts]
min = 10
for i in range(5):
    if a[i] != 0 and min > a[i]:
        b = i
if min == 10:
    b = 0
c = True
end = 0
for i in range(5):
    if c and b == i:
        end += ts[i]
        c = False
    elif a[i] != 0:
        end += (ts[i] // 10 + 1) * 10
    else:
        end += ts[i]
print(end)