unittest
{
	assert( [ "125" ].parse.expand.solve == 176 );
	assert( [ "9999999999" ].parse.expand.solve == 12656242944 );
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto s = input.front;
	return tuple( s );
}

auto solve( string s )
{
	return f( 0, s );
}

long f( long l, string rs )
{
	if( rs.length == 0 ) return l;
	
	auto t = 0L;
	for( auto i = 1L; i <= rs.length; i++ )
	{
		t += f( l + rs[ 0 .. i ].to!long, rs[ i .. $ ] );
	}
	return t;
}
