import math
list = [input() for i in range(5)]
one_min = 9
for i in range(5):
    if one_min >= int(list[i][-1]) > 0:
        one_min = int(list[i][-1])
sum = 0
for i in range(5):
    sum += math.ceil(int(list[i])/10)*10
print(sum - 10 + one_min)