local s=io.read()
local n=#s
local sum=0
for bit=0,(1<<(n-1))-1 do
    local tmp=0
    for i=1,n-1 do
        tmp=tmp*10
        tmp=tmp+s:byte(i)-48
        if bit&(1<<(i-1))>0 then
            sum=sum+tmp
            tmp=0
        end
    end
    tmp=tmp*10
    tmp=tmp+s:byte(n)-48
    sum=sum+tmp
end
print(sum)