#include<iostream>
#include<cstdio>
using namespace std;
long long n,sum,a[13]; //记得开long long
long long dfs(long long x,long long sum,long long sum1)
{
	if(x==1)
		return 2*sum+sum1+a[x]+sum1*10+a[x];
	return dfs(x-1,sum,sum1*10+a[x])+dfs(x-1,sum+sum1,a[x]); //分两种情况dfs
}
int main()
{
	cin>>n;
	while(n!=0)
		sum++,a[sum]=n%10,n/=10;
	cout<<dfs(sum,0,0)/2;
	return 0;
}