# B - Five Dishes

n = []
# n = [29, 20, 7, 35, 120]
for _ in range(5):
    n.append(int(input()))

mini = 10
for y, x in enumerate(n):
    rest = x % 10 
    if rest != 0:
        if rest < mini:
            mini = rest
            mini_num = y 
            
# print(mini)
# print(mini_num)

# print(n.pop(mini_num))

time = n.pop(mini_num)
print(n)
for x in n:
    if x % 10 != 0:
        item = x + (10-x%10)
        time += item
    else:
        item = x
        time += item
#     print('item:', item)
#     print(time)
    
print(time)