import sys

data = list(int(input()) for _ in range(5))

ans = 0

for zero_c in range(len(data)):
  if divmod(data[zero_c], 10)[1] == 0:
    ans += data[zero_c]
    data[zero_c] = 0

for i in range(9, 0, -1):
  for j in range(len(data)):
    if data.count(0) == 4:
      ans += max(data)
      print(ans)
      sys.exit()
    else:
      if divmod(data[j], 10)[1] == i:
        ans += data[j] + (10 - i)
        data[j] = 0
