import math 

dish_list = [int(input()) for _ in range(5)]
last_num_list = [int(str(dish_i)[-1]) for dish_i in dish_list]
last_num_min_index = last_num_list.index(min(last_num_list))

ceiling_dish_list = [10* math.ceil(i/10) for i in dish_list]

print(sum(ceiling_dish_list) - ceiling_dish_list[last_num_min_index] + dish_list[last_num_min_index])