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