import math

A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
list1 = [A,B,C,D,E]
list2 = [i%10 for i in list1]
min_item=9
for i in range(1,10):
    if i in list2:
        min_item = min(min_item,i)
min_index = list2.index(min_item)
total_time = 0
time_seq =[]

for i in range(5):
    if i == min_index:
        continue
    time1 = math.ceil(list1[i]/10) * 10
    total_time += time1
    time_seq.append(time1)
    
total_time += list1[min_index]
print(int(total_time))