l=[int(input()) for i in range(5)]
ans=0
m=[0]*5
count=0
for i in range(5):
  m[i]=l[i]%10
for i in range(5):
  if count==0 and l[i]%10==min(m):
    ans+=l[i]
    count+=1
  else:
    ans+=(-((-l[i])//10))*10
print(ans)