import math

orders = [input() for i in range(5)]
orders_int = list(map(lambda x: int(x), orders))
orders_last_digit = list(map(lambda x: int(x[-1]), orders))
print(orders_int)
print(orders_last_digit)

last_order_index = 0

for i in range(len(orders_int)):
  if (orders_last_digit[i] == 0):
    continue
  if (orders_last_digit[last_order_index] > orders_last_digit[i]):
    last_order_index = i

print(orders_int[last_order_index])

last_order = orders_int.pop(last_order_index)

answer = 0

for item in orders_int:
  answer += math.ceil(item/10) * 10

answer += last_order
print(answer)