function Main(input){
    var S = input;
    var dfs = function(t, i) {
        if(i==S.length-1)
            return t.split("+").map(Number).reduce(function(a,b){ return Number(a)+Number(b)});
        return  dfs(t+S[i+1], i+1) + dfs(t+"+"+S[i+1], i+1);
    }
    return console.log(dfs(S[0],0));
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
// https://teratail.com/questions/272708