input_li = [int(input()) for _ in range(5)]
rest_li = [_ % 10 for _ in input_li]

min_li = min(rest_li)
del rest_li[rest_li.index(min_li)]
total = 0

for i in  rest_li:
    if i != 0:
        total += 10 - i

print(sum(input_li) + total)