#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
string s;
ll rec(ll idx,ll out,ll val)
{
	if(idx==s.size())return out*(val==0);
	return rec(idx+1,out,val*10+s[idx]-'0')+
		   rec(idx+1,out+val*10+s[idx]-'0',0);
}
signed main()
{
	cin>>s;
	cout<<rec(0,0,0)<<endl;
	return 0;
}

