#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld double
#define ff first
#define ss second
ll ans=0,n;
string s;
void solve(ll idx, ll sum){
	if(idx==n){
		ans+=sum;
		return;
	} 
	ll curr=0;
	for(ll i=idx;i<n;++i){
		curr=10*curr+(s[i]-'0');
		solve(i+1,sum+curr);
	}
}
int main(){
	cin>>s;
	s=' '+s;
	n=s.length();
	solve(1,0);
	cout<<ans<<"\n";
	return 0;
}
