a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

list = []
list.append(a)
list.append(b)
list.append(c)
list.append(d)
list.append(e)

list2 = [a%10,b%10,c%10,d%10,e%10]   
for i in range(5):
    if list2[i] == 0:
        list2[i] += 10


for i in range(5):
    for j in range(i,5):
        if list2[i]<list2[j]:
            temp = list[i]
            list[i] = list[j]
            list[j] = temp
            

s = 0
for i in range(4):
    if int(list[i])%10 != 0:
        s += int(list[i])-int(list[i])%10+10
    else:
        s += int(list[i])

s += int(list[4])

print(s)