#include <iostream>
#include <set>
using namespace std;
int n,a[52];
long long go(int x,long long s)
{
	if(x==n)return s;
	long long c=0;
	long long s1=0;
	for(int i=x;i<n;i++)
	{
		c=c*10+a[i];
		s1+=go(i+1,s+c);
	}
	return s1;
}
int main()
{
	char c=getchar();
	while(c<=32)
	{
		c=getchar();
	}
	while(c>32)
	{
		a[n++]=c-'0';
		c=getchar();
	}
	cout<<go(0,0)<<'\n';
	return 0;
}
