foods = [int(input()) for i in range(5)]
time = 0
minmod = 9

for i in foods:
  time += i
  mod = i % 10
  if mod != 0:
    time += 10 - mod
    if mod < minmod:
      minmod = mod  

print(time - 10 + minmod)