def calculation(time_array):
    first_values = [i % 10 if i % 10 != 0 else i for i in time_array]
    minlocation = first_values.index(min(first_values))
    last_order = time_array.pop(minlocation)
    print(first_values)
    print(last_order)
    order_time = [i if i % 10 == 0 else int(i /10) * 10 + 10 for i in time_array]
    return sum(order_time) + last_order

if __name__ == "__main__":
    receipe_time = [int(input()) for i in range(5)]
    # receipe_time = [23, 60, 78, 42, 89]
    print(calculation(receipe_time))
