x=[]
total=[]
for i in range(5):
  t=list(input())
  if t[-1]=='0':
    total.append(t)
  else:
    x.append(t)
x=sorted(x, key=lambda x: x[-1])
for i in range(1,len(x)):
  total.append(x[i])
last=int(''.join(x[0]))
for i in range(4):
  total[i]=int(''.join(total[i]))
  total[i]=-(-total[i]//10)*10

print(sum(total)+last)