#include<bits/stdc++.h>
using namespace std;
const int N=11;
int n;
char c[N];
long long sum,ans;
void dfs(int k,long long now)
{
	if(k>n)
	{
		sum+=now;
		ans+=sum;
		sum-=now;
		return;
	}
	if(now)
		dfs(k+1,now*10+c[k]-'0');
	sum+=now;
	dfs(k+1,c[k]-'0');
	sum-=now;
}
int main()
{
	scanf("%s",c+1);
	n=strlen(c+1);
	dfs(1,0);
	printf("%lld",ans);
	return 0;
}
