li = []
for i in range(5):
    li.append(int(input()))
li2 = [x%10 for x in li]
li3,li4 = [],[]
for i,j in zip(li,li2):
    li3.append([i,j])
li3.sort( key = lambda x:x[1])
import math
for i in range(len(li3)):
    if i == 0:
        li4.append(li3[i][0])
    else:
        li4.append(math.ceil(li3[i][0]/10)*10)
print(sum(li4))