from itertools import permutations
from math import ceil
    
  
time_list = []
for i in range(5):
    time_list.append(int(input()))


min_time = float('inf')


for order in list(permutations([0,1,2,3,4])):
    total = 0
    for i in range(5):
        total += time_list[order[i]]
        if i!=4:
            total = ceil(total / 10) * 10
        print(total)
    min_time = min(min_time, total)
   
  
print(min_time)