dishes_1 = [int(input()) for i in range(5)]
dishes_2 = [i % 10 for i in dishes_1]
dishes_sort = []

min_time = 0

for i in range (5):
    if dishes_2[i] == 0:
       dishes_sort.append(dishes_1[i])

for i in range (9, 1, -1):
    for j in range (5):
        if dishes_2[j] == i:
            dishes_sort.append(dishes_1[j])

for i in range (4):
    for j in range (9):
        if dishes_sort[i] % 10 == 0:
           break
        else:
            dishes_sort[i] += 1
            
print (sum(dishes_sort))