#include <bits/stdc++.h>
using namespace std;
#define LL long long
char s[15];
int pos[15];
LL num(int l,int r)
{
    LL ans=0;
    //cout<<l<<" "<<r<<endl;
    for(int i=l; i<=r; i++)
    {
        ans=ans*10+(s[i]-'0');
    }
    return ans;
}
LL solve(int n)
{
    int l=-1;
    LL ans=0;
    pos[n]=1;
    for(int i=0; i<=n; i++)
    {
        if(pos[i]!=0)
        {
            ans+=num(l+1,i);
            l=i;
        }
    }
    return ans;
}
int main()
{
    while(cin>>s)
    {
        int n=strlen(s);
        long long ans=0;
        int R= (1<<(n-1));
        //cout<<R<<endl;
        for(int i=0; i<R; i++)
        {
            memset(pos,0,sizeof(pos));
            int tot=0;
            int temp=i;
            while(temp)
            {
                pos[tot++]=temp%2;
                temp=temp/2;
            }
            //cout<<solve(n-1)<<endl;
            ans+=solve(n-1);
            //cout<<ans<<endl;
        }
        printf("%lld\n",ans);
    }
    return 0;
}
