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;
        auto tl=str.length-i-1;
        auto tailSum=10L^^tl+2L^^(tl-1)*(5L^^tl-1)/4;
        total+=num*headPattern*tailSum;
    }
    return total;
}