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