a=[int(input()) for i in range(5)]
ans=0
b=sorted([a[i]%10 for i in range(5)])
for i in range(5):
    print(ans)
    ans+=((a[i]+9)//10)*10
for i in range(5):
    if b[i]!=0:
        ans+=b[i]-10
        break
print(ans)