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

min1 = min([i % 10 for i in nums if i%10 != 0])

amount = 0
last = True
for i in nums:
  if last and i% 10 == min1:
    amount += i
    last = False
  else:
    amount += (i //10 + 1)*10 if i %10 != 0 else (i//10)*10
print(amount)