#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
	char a[11];
	cin>>a;
	int si=strlen(a);
	long long s=0;
	for(int i=0;i<(1<<(si-1));i++)
	{
		long long s1=a[0]-'0';
		for(int j=0;j<si-1;j++)
		{
			if(i&(1<<j))
			{
				s+=s1;
				s1=a[j+1]-'0';
			}
			else s1=s1*10+(a[j+1]-'0');
		}
		s+=s1;
	}
	cout<<s<<'\n';
}
