#include <bits/stdc++.h>
using namespace std;
int n;
int a[15];
long long sdf(int x,long long s)
{
	if(x==n)return s;
	long long b=0,s1=0;
	for(int i=x;i<n;i++)
	{
		b=b*10+a[i];
		s1=s1+sdf(i+1,s+b); 
	}
	return s1;
}
int main()
{
	char c;
	c=getchar();
	while(c<=32)
	{
		c=getchar();
	}
	while(c>32)
	{
		a[n++]=c-'0';
		c=getchar();
	}
	cout<<sdf(0,0)<<'\n';
}
