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

for i in foods:
  if i % 10 == 0:
    time += i
  else:
    tmp.append(i)

minmod = 9
for i in tmp:
  mod = i % 10
  time += i + (10 - mod)
  if mod < minmod:
    minmod = mod

print(time - 10 + minmod)