# coding: utf-8

dishes = [int(input()) for _ in range(5)]

min_index = min([(i, d % 10) for i, d in enumerate(dishes) if d % 10 != 0], key=lambda x: x[1])[0]
min_dish = dishes[min_index]
dishes.remove(min_dish)
cooking_time = [d + 10 - (10 if d % 10 == 0 else (d % 10)) for d in dishes]
print(sum(cooking_time) + min_dish)
