import math
a2e_mod = []
for _ in range(5):
  v = input()
  a2e_mod.append([(v + 9) % 10, v])

a2e_mod.sort(reverse=True)
res = 0
for _, v in a2e_mod[:-1]:
  res += math.ceil(v / 10.0) * 10
print int(res + a2e_mod[-1][-1])