import std.stdio,std.string,std.conv,std.bigint;
import std.regex;

void main(){
	
	auto S = num!(BigInt,"")();
	BigInt sum = 0;
	BigInt buf = 0;
	
	foreach( bit ; 0..1<<(S.length-1) ){

		buf = 0;
		foreach( ptr ; 0..S.length ){

			buf = (buf)? buf*10 : BigInt(0) ;
			buf += S[ptr];
			
			if( bit&(1<<ptr) ){
				continue;
			}else{
				sum += buf;
				buf = 0;
				continue;
			}
		}
		if( buf ){sum+=buf;}
	}
	writeln(sum);
}

char[] str(){
	char[] ret;
	foreach( elm ; readln().chomp().split() ){
		//ret ~= elm.to!char();
		ret ~= elm;
	}
	return ret;
}
T[] num( T , string S = " " )(){
	T[] ret;
	foreach( elm ; readln().chomp().split(S) ){
		ret ~= elm.to!T();
	}
	return ret;
}