foods = [ int(input()) for _ in range(5) ]

time = 0
result = 0

for food in foods:
  if food % 10 == 0:
    result += food
  else:
    result += (food // 10 + 1) * 10
    if food % 10 > time:
      time = 10 - food % 10

print(result - time)