t = []
for i in range(5):
  t.append(int(input()))
total = 0
#add the x%10==0s first
#let the last one be x%10 is minimum but not 0
#How am I suppose to compare infinite numbers in pyhton like in c?

last = 256

for x in t:
  if x%10 ==0:
    total+=x
    t.pop(t.index(x))
  elif last>200 or x%10<last%10:
    last = x
if last < 200:
  t.pop(t.index(last))

t.append(last)
for i in range(len(t)):
  temp = total
  if i==0:
    total+=t[i]
  else:
    if t[i-1]%10 == 0:
      total += t[i]
    else:
      total += t[i] + (10 - t[i-1]%10)
print(total)