def main():
  A = int(input())
  B = int(input())
  C = int(input())
  D = int(input())
  E = int(input())

  orders = sorted([A,B,C,D,E])
  lunch = {}
  # wattayatu = [10 - (n % 10) for n in orders if n % 10 != 0]
  n10 = []
  for i, n in enumerate(orders):
    if n % 10 == 0:
      n10.append(n)
    else:
      lunch[n] = 10 - (n % 10)
  lunch2 = {}
  for k, v in sorted(lunch.items(), key=lambda x: x[1]):
    lunch2[k] = v


  result = sum(n10)
  for i, (k, v) in enumerate(lunch2.items()):
    if (i+1) == len(lunch2):
      result += k
    else:
      result += k + v
  print(result)


main()