A=list([int(input()) for i in range(5)])
ans=0
B=[]
for i in range(5):
    if A[i]%10!=0:
        B.append(A[i]%10)
for i in range(5):
    if A[i]%10==0:
        ans+=A[i]
    else:
        ans+=(A[i]//10+1)*10
        if A[i]%10==min(B):
            ans-=(10-A[i]%10)
print(ans)