list = [int(input()) for n in range(5)]
min = 100
for i in range(5):
  if min > list[i] % 10:
    min = list[i] % 10
    min_arg = i
ans = 0
for i in range(5):
  if ans == 0 and i != min_arg:
    ans += list[i]
    continue
  if i == min_arg:
    continue
  ans = ((ans - (ans % 10) + 10) + list[i])
  print(ans)
ans = ((ans - (ans % 10) + 10) + list[min_arg])
print(ans)