cook = []
t = 0
for i in range(5):
    cook.append(int(input()))

for i in range(5):
    if cook[i] % 10 != 0:
        t += cook[i] + (10 - cook[i] % 10)
    else:
        t += cook[i]

amari = []
for i in range(5):
    if cook[i] % 10 != 0:
        amari.append((10 - cook[i] % 10))

print(t - max(amari))
