sum = 0
time_list = []
for i in range(5):
    time = int(input())
    if time%10 == 0:
        sum += time
    else:
        time_list.append([time, time-time%10+10, time%10])

time_list.sort(key=lambda x: x[2])
sum += time_list.pop(0)[0]
for t in time_list:
    sum += t[1]

print(sum)