import std.stdio, std.string, std.conv;
import std.algorithm, std.array;
 
auto solve(string S) {
    immutable N = S.length.to!int();
    immutable s = S.map!(c=>(c-'0').to!long()).array();
    auto v = new long[][](N,N);
    v[0][]=s;
    foreach(i;1..N)
        foreach(j;0..N-i)
            v[i][j]=v[i-1][j]*10+s[i+j];
    long t=0;
    foreach(i;0..N)
        foreach(j;0..i+1)
            t+=v[N-1-i][j]*(1L<<max(0,j-1))*(1L<<max(0,i-j-1));
    return t;
}
void main(){ for(string s; (s=readln.chomp()).length;) writeln(solve(s)); }