#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll x,ans=0;
int n,num[15];
void dfs(int pos,ll sum){
	if(pos==n+1) {
		ans+=sum;return;
	}
	ll tmp=0;
	for(int i=pos;i<=n;i++)tmp=tmp*10+num[i],dfs(i+1,sum+tmp);
}
int main(){
	cin>>x;
	while(x)num[++n]=x%10,x/=10;
	reverse(num+1,num+n+1);
	dfs(1,0);
	cout<<ans;
	return 0;
}