lis = []
for i in range(5):
    lis.append(int(input()))
plus = 0
notdiv = []
for i in range(5):
    if lis[i] % 10 != 0:
        plus += 10 - (lis[i] % 10)
        notdiv.append(lis[i])
for i in range(5):
    notdiv[i] %= 10
    notdiv[i] = 10 - notdiv[i]


notdiv.sort()
print(sum(lis) + plus - notdiv[-1])