menew=[int(input()) for i in range(5)]
small=0
jo=10
for i in range(5):
    if menew[i]%10<jo and menew[i]%10!=0:
        jo=menew[i]%10
        small=menew[i]
menew.remove(small)
ans=0
for i in range(4):
    if menew[i]%10==0:
        p=0
    else:
        p=10-menew[i]%10
    ans+=menew[i]+p
    
ans+=small
print(ans)

