a,b,c,d,e=[int(input()) for i in range(5)]
zero=[-(-a//10)*10, -(-b//10)*10, -(-c//10)*10, -(-d//10)*10, -(-e//10)*10]
mod=[a%10, b%10, c%10, d%10, e%10]
if sum(mod)==0:
    ans=a+b+c+d+e
else:
    while 0 in mod:
        mod.remove(0)
        m=min(mod)
        ans=sum(zero)-10+m
print(ans)