order = []
amari = []
show = []
for i in range(5):
  order.append(int(input()))
  s = order[i] % 10
  t = ((order[i] // 10) + 1) * 10
  amari.append(s)
  show.append(t)
ans = sum(show) - 10 + min(amari)
print(ans)