import std.stdio, std.string, std.array, std.conv, std.algorithm, std.typecons, std.range, std.container, std.math, std.algorithm.searching, std.functional,std.mathspecial;

void main(){
    writeln(totalSum(readln.chomp));
}

long totalSum(string str){
    long total=0;
    foreach(i,s;str){
        auto num=[s].to!long;
        auto headPattern=2^^i;
        foreach(k;0..str.length-i){
            auto tailLength=str.length-i-1-k;
            auto tailPattern=tailLength==0?1:2^^(tailLength-1);
            total+=num*10^^k*headPattern*tailPattern;
        }
    }
    return total;
}