an = [int(input()) for i in range(5)]
total = 0

for i in range(5):
  tot = (an[i] // 10) * 10
  an[i] -= tot
  total += tot
  if an[i] == 0:
    del an[i]
if len(an) > 0:
  total += min(an) + (len(an) - 1)*10
print(total)