import math

cycles = []
for i in range(5):
    cycles.append(int(input()))


minimum_last_order_cycle = 9
for cycle in cycles:
    if cycle % 10 <= minimum_last_order_cycle % 10 and cycle % 10 > 0:
        minimum_last_order_cycle = cycle

cycles.remove(minimum_last_order_cycle)

time = 0
for cycle in cycles:
    time += math.ceil(cycle / 10) * 10

time += minimum_last_order_cycle

print(time)
