dishes = [input() for i in range(5)]

sum_time = 0
last_order_surplus = 10

for dish in dishes:
  if last_order_surplus > int(dish) % 10 & int(dish) % 10 != 0:
    last_order_surplus = int(dish) % 10
  if int(dish) % 10 != 0:
    sum_time += int(int(dish) / 10 + 1)
  else:
    sum_time = int(int(dish) / 10)

print (sum_time * 10 + last_order_surplus - 10)