#include<bits/stdc++.h>
#define re register
#define ll long long
using namespace std;
inline int read(){
	int k=1,sum=0;
	char c=getchar();
	for(;c<'0' || c>'9';c=getchar()) if(c=='-') k=-1;
	for(;c>='0' && c<='9';c=getchar()) sum=sum*10+c-48;
	return sum*k;
}
string s;
ll sum[20];
ll ans;
int n;
bool vis[20];
inline ll calc(){
	ll sum=0,res=0;
	for(re int i=0;i<n-1;++i){
		sum=sum*10+s[i];
		if(vis[i]) {res+=sum;sum=0;}
	}
	sum=sum*10+s[n-1];
	return res+sum;
}
inline void dfs(int x){
	if(x==n-1) {ans+=calc();return;}
	vis[x]=1;
	dfs(x+1);
	vis[x]=0;
	dfs(x+1);
}
int main(){
	cin>>s;n=s.length();
	for(re int i=0;i<n;++i) s[i]-='0';
	dfs(0);
	cout<<ans;
	return 0;
}
/*
6 3
2 3
1 2 
1 4 
4 5 
4 6 
0 2 5 1 2 3 
1 5 
1 3 
2 6 
*/