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

X = [a,b,c,d,e]

order_list = []
for x in X:
    priority = x % 10
    if priority == 0:
        priority = 10
    order_list.append([x, priority])

order_list.sort(key=lambda order: order[1])

total_time = 0
for time, priority in order_list[1:]:
    plus10 = 0
    if time % 10 > 0:
        plus10 = 10
    actual_time = time//10*10 + plus10
    total_time += actual_time
    print([time, priority], actual_time, total_time)

order = order_list.pop(0)
time = order[0]
total_time += time

print(total_time)
