t=[0]*5
for i in range(5):
    t[i]=int(input())
ans=0
min=10
c=6
for i in range(5):
    if t[i]%10!=0 and t[i]%10<min:
        c=i
        min=t[i]
for i in range(5):
    if i==c:
        ans+=t[i]
    elif t[i]%10==0:
        ans+=t[i]
    else:
        ans+=t[i]-t[i]%10+10
print(ans)