b=10
k=0
d=[]
ans=[]
for i in range(5):
  a=int(input())
  d.append(a)
  if b>a%10 and a%10!=0:
    b=a%10
    k=i
  if a%10==0:
    ans.append(a)
  else:
    ans.append((a//10+1)*10)
if k!=0:
  ans[k]=d[k]
print(sum(ans))