#include <bits/stdc++.h>
#define ll long long
using namespace std;

ll ans=0;
string s;

void dfs(ll i,ll val,ll cnt)
{
    if(i==s.length())
    {
        ans+=val+cnt;
        return;
    }
    ll x=s[i]-'0';
    dfs(i+1,x,val+cnt);
    dfs(i+1,val*10+x,cnt);
}

int main()
{
    cin>>s;
    dfs(1,s[0]-'0',0);
    cout<<ans;
    return 0;
}
