order_time = [0, 0, 0, 0, 0]
order = len(order_time)
time = 0
last_order = 9

for i in range(0, order):
    order_time[i] = int(input())
    if (order_time[i] % 10 < last_order % 10):
        last_order = order_time[i]

for i in range(0, order):
    if (order_time[i] == last_order):
        continue
    elif(order_time[i] % 10 != 0):
        time += order_time[i] // 10 * 10 + 10
    else:
        time += order_time[i]
time += last_order

print(time)
