dish_time = [int(input()) for i in range(5)]
A = dish_time
rest=[0,0,0,0,0]

for j in range(5):
    dish_time[j] = dish_time[j]//10*10
    rest[j]= A[j]-dish_time[j]

print(dish_time)

sum_time =  0
rest.sort()

for i in range(5):
    sum_time = sum_time + dish_time[i]

sum_time = sum_time + rest[0]

print(sum_time)