r=[int(input()) for _ in range(5)]
#print(r)

ans=0
rowMin=9

for item in r:
  ans+=(((-1*item)//10)*(-10))
  if item%10 !=0 and item%10<rowMin%10:
    rowMin=item
    

ans=ans+rowMin-(((-1*rowMin)//10)*(-10))
print(ans)