from math import ceil
time_list = [int(input()) for i in range(5)]
x_list = []
for i in time_list:
    x_list.append(i % 10)
    i = ceil(i / 10) * 1
if max(x_list) == 0:
    print(sum(x_list))
else:
    print(sum(x_list) + 10 - max(x_list))
