X=[int(input()) for i in range(5)]

ans=0
W=[]

for i in range(len(X)):
    if X[i]%10 == 0:
        ans+=X[i]
    else:
        ans+=(X[i]//10)*10+10
        W.append(X[i]%10)

ans +=-10+min(W)
print(ans)