times = []
min_unit_place = 9
min_unit_index = None

for i in range(5):
  time_i = input()
  times.append(int(time_i))
  unit_place = int(time_i[-1])
  if unit_place > 0 and min_unit_place > unit_place:
    min_unit_place = unit_place
    min_unit_index = i
  
answer = 0
for i, t in enumerate(times):
  if i == min_unit_index or t%10 == 0:
    answer += t
  else:
    answer = answer + t + (10-t%10)

print(answer)
    