import math

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

last = 0
best_mod = 10
for time in times:
    mod = time % 10
    if mod == 0:
        mod = 10
    if mod <= best_mod:
        last = time
        best_mod = mod

all_time = 0
for time in times:
    if time == last:
        all_time += time
    else:
        all_time += math.ceil(time/10.0) * 10

print(all_time)