A=list(int(input())for i in range(5))
com=0
for i in range(5):
    if A[i]%10==0:
        continue
    else:
        rem=10-A[i]%10
    if com<rem:
        com=rem
        num=i
        tmp=A[i]
A[num]=0
ans=0
for a in A:
    if a==0:
        continue
    if a%10==0:
        ans+=a
    else:
        ans+=(a//10+1)*10
ans+=tmp
print(ans)
