import math
input_list = []
for i in range(5):
    input_list.append(int(input()))

sorted_list = sorted(input_list, key=lambda v: v%10, reverse=True)

time = 0
for v in sorted_list[:-1]:
    time += math.ceil(v/10)*10
time += sorted_list[-1]

# print(sorted_list)
print(time)