stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include<iostream>

#include<string>

#include<stdlib.h>

#include<cmath>

using namespace std;

	long long ans = 0;

void dfs(long long s,long long n)

{

	if (s == 0) ans+=n;

	else {

		int t = log10(s);

		//ans += s;

		while (t >= 0)

		{

			long long a = s / pow(10, t);

			//ans += a+n;

			// cout << a << endl;

			long long b = s - a*pow(10, t);

			dfs(b, a + n);

			t--;

		}

	}

}

int main()

{

	long long s;

	cin >> s;

	dfs(s,0);

	cout << ans;



}

// Faster C++ solution for the same problem (measured speedup: 5.280145392904913x):
#include<stdio.h>

#include<algorithm>

#include<string.h>

using namespace std ;

#define N 15

int main()

{

    int n,m=1,i,j;

    char x[15];

    long long sum=0,a;

    scanf("%s",x);

    n=strlen(x);

    for(i=0;i<n-1;i++)

    {

        m=m*2;

    }

    for(i=0;i<m;i++)

    {

        a=x[0]-'0';

        for(j=0;j<n;j++)

        {

            if(j==n-1||i&1<<j)

            {

            sum=sum+a;

            a=0;

            if(j==n-1) break;

            }

            a=a*10;

            a=a+x[j+1]-'0';

        }

    }

    printf("%lld",sum);

    return 0;

}
// Slower C++ solution:
#include <iostream>

#include <cstring>

#include <cmath>

#include <algorithm>

using namespace std;

const int MAXN = 15;

char s[MAXN];

int main() {

    ios::sync_with_stdio(false);

    while(cin >> s){

        int len = strlen(s);

        long long ans = 0;

        for(int i = 0; i < (1 << (len - 1)); i++){

            long long t = s[0] - '0';

            for(int j = 0; j < len; j++){

                if(j == len - 1 || i & (1 << j)){

                    ans += t;

                    t = 0;

                    if(len - 1 == j) 

						break;

                }

                t *= 10;

                t += s[j + 1] - '0';

            }

        }

        cout << ans << endl;

    }



    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.3407199389255124x):
#include<stdio.h>

#include<algorithm>

#include<string.h>

using namespace std ;

#define N 15

int main()

{

    int n,m=1,i,j;

    char x[15];

    long long sum=0,a;

    scanf("%s",x);

    n=strlen(x);

    for(i=0;i<n-1;i++)

    {

        m=m*2;

    }

    for(i=0;i<m;i++)

    {

        a=x[0]-'0';

        for(j=0;j<n;j++)

        {

            if(j==n-1||i&1<<j)

            {

            sum=sum+a;

            a=0;

            if(j==n-1) break;

            }

            a=a*10;

            a=a+x[j+1]-'0';

        }

    }

    printf("%lld",sum);

    return 0;

}
// Slower C++ solution:
#include <iostream>

#include <string>

using namespace std;

    using ll = long long;

    ll num[15][15];

    ll ans=0;

    int n;

void run(int step,ll sum)

{

    if(step==n)

    {

        ans+=sum;

        return;

    }

    for(int i=step;i<n;i++)

        run(i+1,sum+num[step][i]);

    return;

}

int main()

{

    string s;

    cin>>s;

    n=s.size();

    for(int i=0;i<n;i++)

    {

        string t;

        for(int j=i;j<n;j++)

        {

            t.push_back(s[j]);

            num[i][j]=stoll(t);

        }

    }

    run(0,0);

    cout<<ans<<endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.315790098881406x):
#include<stdio.h>

#include<algorithm>

#include<string.h>

using namespace std ;

#define N 15

int main()

{

    int n,m=1,i,j;

    char x[15];

    long long sum=0,a;

    scanf("%s",x);

    n=strlen(x);

    for(i=0;i<n-1;i++)

    {

        m=m*2;

    }

    for(i=0;i<m;i++)

    {

        a=x[0]-'0';

        for(j=0;j<n;j++)

        {

            if(j==n-1||i&1<<j)

            {

            sum=sum+a;

            a=0;

            if(j==n-1) break;

            }

            a=a*10;

            a=a+x[j+1]-'0';

        }

    }

    printf("%lld",sum);

    return 0;

}
// Slower C++ solution:
#include<iostream>



using namespace std;



long long int cclt(long long int n);

long long int c(long long int n);



int main()

{

    long long int n;

    cin>>n;

    long long int rst=0;

    rst=cclt(n);

    cout<<rst<<endl;

    return 0;

}



long long int cclt(long long int n)

{

    if(n==0)

    {

        return 0;

    }

    long long int rst=0,f=1;

    while(n/f>0)

    {

        rst+=cclt(n%f)+(n/f)*c(n%f);

        f*=10;

    }

    return rst;

}



long long int c(long long int n)

{

    int t=1;

    while(n/10>0)

    {

        t*=2;

        n/=10;

    }

    return t;

}

// Faster C++ solution for the same problem (measured speedup: 5.268022398399388x):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

char s[15];

int n;

inline long long dfs(int x,long long sum,int last)

{

	long long ml=0;

	for(int i=last;i<=x;i++)

		ml=ml*10+s[i]-'0';

	if(x>=n)

		return sum+ml;

	return dfs(x+1,sum+ml,x+1)+dfs(x+1,sum,last);

}

int main()

{

	scanf("%s",s+1);

	n=strlen(s+1);

	printf("%lld\n",dfs(1,0,1));

}
// Slower C++ solution:
#include<iostream>

#include<string>

#include<stdlib.h>

#include<cmath>

using namespace std;

	long long ans = 0;

void dfs(long long s,long long n)

{

	if (s == 0) ans+=n;

	else {

		int t = log10(s);

		//ans += s;

		while (t >= 0)

		{

			long long a = s / pow(10, t);

			//ans += a+n;

			// cout << a << endl;

			long long b = s - a*pow(10, t);

			dfs(b, a + n);

			t--;

		}

	}

}

int main()

{

	long long s;

	cin >> s;

	dfs(s,0);

	cout << ans;



}

// Faster C++ solution for the same problem (measured speedup: 5.272963654012927x):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

char s[15];

int n;

inline long long dfs(int x,long long sum,int last)

{

	long long ml=0;

	for(int i=last;i<=x;i++)

		ml=ml*10+s[i]-'0';

	if(x>=n)

		return sum+ml;

	return dfs(x+1,sum+ml,x+1)+dfs(x+1,sum,last);

}

int main()

{

	scanf("%s",s+1);

	n=strlen(s+1);

	printf("%lld\n",dfs(1,0,1));

}
// Slower C++ solution:
#include <iostream>

#include <cstring>

#include <cmath>

#include <algorithm>

using namespace std;

const int MAXN = 15;

char s[MAXN];

int main() {

    ios::sync_with_stdio(false);

    while(cin >> s){

        int len = strlen(s);

        long long ans = 0;

        for(int i = 0; i < (1 << (len - 1)); i++){

            long long t = s[0] - '0';

            for(int j = 0; j < len; j++){

                if(j == len - 1 || i & (1 << j)){

                    ans += t;

                    t = 0;

                    if(len - 1 == j) 

						break;

                }

                t *= 10;

                t += s[j + 1] - '0';

            }

        }

        cout << ans << endl;

    }



    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.333455810148277x):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

char s[15];

int n;

inline long long dfs(int x,long long sum,int last)

{

	long long ml=0;

	for(int i=last;i<=x;i++)

		ml=ml*10+s[i]-'0';

	if(x>=n)

		return sum+ml;

	return dfs(x+1,sum+ml,x+1)+dfs(x+1,sum,last);

}

int main()

{

	scanf("%s",s+1);

	n=strlen(s+1);

	printf("%lld\n",dfs(1,0,1));

}
// Slower C++ solution:
#include <iostream>

#include <string>

using namespace std;

    using ll = long long;

    ll num[15][15];

    ll ans=0;

    int n;

void run(int step,ll sum)

{

    if(step==n)

    {

        ans+=sum;

        return;

    }

    for(int i=step;i<n;i++)

        run(i+1,sum+num[step][i]);

    return;

}

int main()

{

    string s;

    cin>>s;

    n=s.size();

    for(int i=0;i<n;i++)

    {

        string t;

        for(int j=i;j<n;j++)

        {

            t.push_back(s[j]);

            num[i][j]=stoll(t);

        }

    }

    run(0,0);

    cout<<ans<<endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.308559878185956x):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

char s[15];

int n;

inline long long dfs(int x,long long sum,int last)

{

	long long ml=0;

	for(int i=last;i<=x;i++)

		ml=ml*10+s[i]-'0';

	if(x>=n)

		return sum+ml;

	return dfs(x+1,sum+ml,x+1)+dfs(x+1,sum,last);

}

int main()

{

	scanf("%s",s+1);

	n=strlen(s+1);

	printf("%lld\n",dfs(1,0,1));

}
// Slower C++ solution:
#include<iostream>



using namespace std;



long long int cclt(long long int n);

long long int c(long long int n);



int main()

{

    long long int n;

    cin>>n;

    long long int rst=0;

    rst=cclt(n);

    cout<<rst<<endl;

    return 0;

}



long long int cclt(long long int n)

{

    if(n==0)

    {

        return 0;

    }

    long long int rst=0,f=1;

    while(n/f>0)

    {

        rst+=cclt(n%f)+(n/f)*c(n%f);

        f*=10;

    }

    return rst;

}



long long int c(long long int n)

{

    int t=1;

    while(n/10>0)

    {

        t*=2;

        n/=10;

    }

    return t;

}

// Faster C++ solution for the same problem (measured speedup: 5.268022398399388x):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

char s[15];

int n;

inline long long dfs(int x,long long sum,int last)

{

	long long ml=0;

	for(int i=last;i<=x;i++)

		ml=ml*10+s[i]-'0';

	if(x>=n)

		return sum+ml;

	return dfs(x+1,sum+ml,x+1)+dfs(x+1,sum,last);

}

int main()

{

	scanf("%s",s+1);

	n=strlen(s+1);

	printf("%lld\n",dfs(1,0,1));

	return 0;

}
// Slower C++ solution:
#include<iostream>

#include<string>

#include<stdlib.h>

#include<cmath>

using namespace std;

	long long ans = 0;

void dfs(long long s,long long n)

{

	if (s == 0) ans+=n;

	else {

		int t = log10(s);

		//ans += s;

		while (t >= 0)

		{

			long long a = s / pow(10, t);

			//ans += a+n;

			// cout << a << endl;

			long long b = s - a*pow(10, t);

			dfs(b, a + n);

			t--;

		}

	}

}

int main()

{

	long long s;

	cin >> s;

	dfs(s,0);

	cout << ans;



}

// Faster C++ solution for the same problem (measured speedup: 5.272963654012927x):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

char s[15];

int n;

inline long long dfs(int x,long long sum,int last)

{

	long long ml=0;

	for(int i=last;i<=x;i++)

		ml=ml*10+s[i]-'0';

	if(x>=n)

		return sum+ml;

	return dfs(x+1,sum+ml,x+1)+dfs(x+1,sum,last);

}

int main()

{

	scanf("%s",s+1);

	n=strlen(s+1);

	printf("%lld\n",dfs(1,0,1));

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <cstring>

#include <cmath>

#include <algorithm>

using namespace std;

const int MAXN = 15;

char s[MAXN];

int main() {

    ios::sync_with_stdio(false);

    while(cin >> s){

        int len = strlen(s);

        long long ans = 0;

        for(int i = 0; i < (1 << (len - 1)); i++){

            long long t = s[0] - '0';

            for(int j = 0; j < len; j++){

                if(j == len - 1 || i & (1 << j)){

                    ans += t;

                    t = 0;

                    if(len - 1 == j) 

						break;

                }

                t *= 10;

                t += s[j + 1] - '0';

            }

        }

        cout << ans << endl;

    }



    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.333455810148277x):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

char s[15];

int n;

inline long long dfs(int x,long long sum,int last)

{

	long long ml=0;

	for(int i=last;i<=x;i++)

		ml=ml*10+s[i]-'0';

	if(x>=n)

		return sum+ml;

	return dfs(x+1,sum+ml,x+1)+dfs(x+1,sum,last);

}

int main()

{

	scanf("%s",s+1);

	n=strlen(s+1);

	printf("%lld\n",dfs(1,0,1));

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <string>

using namespace std;

    using ll = long long;

    ll num[15][15];

    ll ans=0;

    int n;

void run(int step,ll sum)

{

    if(step==n)

    {

        ans+=sum;

        return;

    }

    for(int i=step;i<n;i++)

        run(i+1,sum+num[step][i]);

    return;

}

int main()

{

    string s;

    cin>>s;

    n=s.size();

    for(int i=0;i<n;i++)

    {

        string t;

        for(int j=i;j<n;j++)

        {

            t.push_back(s[j]);

            num[i][j]=stoll(t);

        }

    }

    run(0,0);

    cout<<ans<<endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.308559878185956x):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

char s[15];

int n;

inline long long dfs(int x,long long sum,int last)

{

	long long ml=0;

	for(int i=last;i<=x;i++)

		ml=ml*10+s[i]-'0';

	if(x>=n)

		return sum+ml;

	return dfs(x+1,sum+ml,x+1)+dfs(x+1,sum,last);

}

int main()

{

	scanf("%s",s+1);

	n=strlen(s+1);

	printf("%lld\n",dfs(1,0,1));

	return 0;

}
// Slower C++ solution:
#include<iostream>



using namespace std;



long long int cclt(long long int n);

long long int c(long long int n);



int main()

{

    long long int n;

    cin>>n;

    long long int rst=0;

    rst=cclt(n);

    cout<<rst<<endl;

    return 0;

}



long long int cclt(long long int n)

{

    if(n==0)

    {

        return 0;

    }

    long long int rst=0,f=1;

    while(n/f>0)

    {

        rst+=cclt(n%f)+(n/f)*c(n%f);

        f*=10;

    }

    return rst;

}



long long int c(long long int n)

{

    int t=1;

    while(n/10>0)

    {

        t*=2;

        n/=10;

    }

    return t;

}

// Faster C++ solution for the same problem (measured speedup: 5.260207536346926x):
#include<cstdio>

#include<cstring>

#include<cmath>

#include<algorithm>



using namespace std;



int n;

char s[12];

long long a[12],num[12];

long long ans;



void work(int tmp)

{

	for(int i=1;i<=tmp;i++)ans+=num[i];

}



void dfs(int x,int tmp)

{

	if(x>n){work(tmp);return;}

	num[tmp]=num[tmp]*10+a[x];

	dfs(x+1,tmp+1);

	dfs(x+1,tmp);

	num[tmp]/=10;

}



int main()

{

	scanf("%s",s+1);

	n=strlen(s+1);

	for(int i=1;i<=n;i++)

		a[i]=s[i]-48;

	dfs(1,1);

	printf("%lld\n",ans/2);

}
// Slower C++ solution:
#include<iostream>

#include<string>

#include<stdlib.h>

#include<cmath>

using namespace std;

	long long ans = 0;

void dfs(long long s,long long n)

{

	if (s == 0) ans+=n;

	else {

		int t = log10(s);

		//ans += s;

		while (t >= 0)

		{

			long long a = s / pow(10, t);

			//ans += a+n;

			// cout << a << endl;

			long long b = s - a*pow(10, t);

			dfs(b, a + n);

			t--;

		}

	}

}

int main()

{

	long long s;

	cin >> s;

	dfs(s,0);

	cout << ans;



}

// Faster C++ solution for the same problem (measured speedup: 5.265141461841482x):
#include<cstdio>

#include<cstring>

#include<cmath>

#include<algorithm>



using namespace std;



int n;

char s[12];

long long a[12],num[12];

long long ans;



void work(int tmp)

{

	for(int i=1;i<=tmp;i++)ans+=num[i];

}



void dfs(int x,int tmp)

{

	if(x>n){work(tmp);return;}

	num[tmp]=num[tmp]*10+a[x];

	dfs(x+1,tmp+1);

	dfs(x+1,tmp);

	num[tmp]/=10;

}



int main()

{

	scanf("%s",s+1);

	n=strlen(s+1);

	for(int i=1;i<=n;i++)

		a[i]=s[i]-48;

	dfs(1,1);

	printf("%lld\n",ans/2);

}
// Slower C++ solution:
#include <iostream>

#include <cstring>

#include <cmath>

#include <algorithm>

using namespace std;

const int MAXN = 15;

char s[MAXN];

int main() {

    ios::sync_with_stdio(false);

    while(cin >> s){

        int len = strlen(s);

        long long ans = 0;

        for(int i = 0; i < (1 << (len - 1)); i++){

            long long t = s[0] - '0';

            for(int j = 0; j < len; j++){

                if(j == len - 1 || i & (1 << j)){

                    ans += t;

                    t = 0;

                    if(len - 1 == j) 

						break;

                }

                t *= 10;

                t += s[j + 1] - '0';

            }

        }

        cout << ans << endl;

    }



    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.325543880724463x):
#include<cstdio>

#include<cstring>

#include<cmath>

#include<algorithm>



using namespace std;



int n;

char s[12];

long long a[12],num[12];

long long ans;



void work(int tmp)

{

	for(int i=1;i<=tmp;i++)ans+=num[i];

}



void dfs(int x,int tmp)

{

	if(x>n){work(tmp);return;}

	num[tmp]=num[tmp]*10+a[x];

	dfs(x+1,tmp+1);

	dfs(x+1,tmp);

	num[tmp]/=10;

}



int main()

{

	scanf("%s",s+1);

	n=strlen(s+1);

	for(int i=1;i<=n;i++)

		a[i]=s[i]-48;

	dfs(1,1);

	printf("%lld\n",ans/2);

}
// Slower C++ solution:
#include <iostream>

#include <string>

using namespace std;

    using ll = long long;

    ll num[15][15];

    ll ans=0;

    int n;

void run(int step,ll sum)

{

    if(step==n)

    {

        ans+=sum;

        return;

    }

    for(int i=step;i<n;i++)

        run(i+1,sum+num[step][i]);

    return;

}

int main()

{

    string s;

    cin>>s;

    n=s.size();

    for(int i=0;i<n;i++)

    {

        string t;

        for(int j=i;j<n;j++)

        {

            t.push_back(s[j]);

            num[i][j]=stoll(t);

        }

    }

    run(0,0);

    cout<<ans<<endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.300684880699638x):
#include<cstdio>

#include<cstring>

#include<cmath>

#include<algorithm>



using namespace std;



int n;

char s[12];

long long a[12],num[12];

long long ans;



void work(int tmp)

{

	for(int i=1;i<=tmp;i++)ans+=num[i];

}



void dfs(int x,int tmp)

{

	if(x>n){work(tmp);return;}

	num[tmp]=num[tmp]*10+a[x];

	dfs(x+1,tmp+1);

	dfs(x+1,tmp);

	num[tmp]/=10;

}



int main()

{

	scanf("%s",s+1);

	n=strlen(s+1);

	for(int i=1;i<=n;i++)

		a[i]=s[i]-48;

	dfs(1,1);

	printf("%lld\n",ans/2);

}
// Slower C++ solution:
#include<iostream>



using namespace std;



long long int cclt(long long int n);

long long int c(long long int n);



int main()

{

    long long int n;

    cin>>n;

    long long int rst=0;

    rst=cclt(n);

    cout<<rst<<endl;

    return 0;

}



long long int cclt(long long int n)

{

    if(n==0)

    {

        return 0;

    }

    long long int rst=0,f=1;

    while(n/f>0)

    {

        rst+=cclt(n%f)+(n/f)*c(n%f);

        f*=10;

    }

    return rst;

}



long long int c(long long int n)

{

    int t=1;

    while(n/10>0)

    {

        t*=2;

        n/=10;

    }

    return t;

}

// Faster C++ solution for the same problem (measured speedup: 5.2649929497256x):
#include <cstdio>

#include <cstring>

char s[32];

int len,tong[32];

long long answer;

void charge(int dep,long long num,int cnt) {

	if(dep==len) {

		long long ans=num;

	//	printf("%d ",num);

		for(int i=cnt;i>=1;--i) {

			ans+=tong[i];

		//	printf("%d ",tong[i]);

		}

		//printf("\n");

		answer+=ans;

		return ;

	}

	tong[cnt+1]=num;

	charge(dep+1,s[dep]-'0',cnt+1);

	tong[cnt+1]=0;

	charge(dep+1,num*10+s[dep]-'0',cnt);

}

int main() {

	scanf("%s",s);

	len=strlen(s);

	answer=0;

	charge(0,0,0);

	printf("%lld\n",answer/2);

	return 0;

}
// Slower C++ solution:
#include<iostream>

#include<string>

#include<stdlib.h>

#include<cmath>

using namespace std;

	long long ans = 0;

void dfs(long long s,long long n)

{

	if (s == 0) ans+=n;

	else {

		int t = log10(s);

		//ans += s;

		while (t >= 0)

		{

			long long a = s / pow(10, t);

			//ans += a+n;

			// cout << a << endl;

			long long b = s - a*pow(10, t);

			dfs(b, a + n);

			t--;

		}

	}

}

int main()

{

	long long s;

	cin >> s;

	dfs(s,0);

	cout << ans;



}

// Faster C++ solution for the same problem (measured speedup: 5.269931363802195x):
#include <cstdio>

#include <cstring>

char s[32];

int len,tong[32];

long long answer;

void charge(int dep,long long num,int cnt) {

	if(dep==len) {

		long long ans=num;

	//	printf("%d ",num);

		for(int i=cnt;i>=1;--i) {

			ans+=tong[i];

		//	printf("%d ",tong[i]);

		}

		//printf("\n");

		answer+=ans;

		return ;

	}

	tong[cnt+1]=num;

	charge(dep+1,s[dep]-'0',cnt+1);

	tong[cnt+1]=0;

	charge(dep+1,num*10+s[dep]-'0',cnt);

}

int main() {

	scanf("%s",s);

	len=strlen(s);

	answer=0;

	charge(0,0,0);

	printf("%lld\n",answer/2);

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <cstring>

#include <cmath>

#include <algorithm>

using namespace std;

const int MAXN = 15;

char s[MAXN];

int main() {

    ios::sync_with_stdio(false);

    while(cin >> s){

        int len = strlen(s);

        long long ans = 0;

        for(int i = 0; i < (1 << (len - 1)); i++){

            long long t = s[0] - '0';

            for(int j = 0; j < len; j++){

                if(j == len - 1 || i & (1 << j)){

                    ans += t;

                    t = 0;

                    if(len - 1 == j) 

						break;

                }

                t *= 10;

                t += s[j + 1] - '0';

            }

        }

        cout << ans << endl;

    }



    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.330388733091872x):
#include <cstdio>

#include <cstring>

char s[32];

int len,tong[32];

long long answer;

void charge(int dep,long long num,int cnt) {

	if(dep==len) {

		long long ans=num;

	//	printf("%d ",num);

		for(int i=cnt;i>=1;--i) {

			ans+=tong[i];

		//	printf("%d ",tong[i]);

		}

		//printf("\n");

		answer+=ans;

		return ;

	}

	tong[cnt+1]=num;

	charge(dep+1,s[dep]-'0',cnt+1);

	tong[cnt+1]=0;

	charge(dep+1,num*10+s[dep]-'0',cnt);

}

int main() {

	scanf("%s",s);

	len=strlen(s);

	answer=0;

	charge(0,0,0);

	printf("%lld\n",answer/2);

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <string>

using namespace std;

    using ll = long long;

    ll num[15][15];

    ll ans=0;

    int n;

void run(int step,ll sum)

{

    if(step==n)

    {

        ans+=sum;

        return;

    }

    for(int i=step;i<n;i++)

        run(i+1,sum+num[step][i]);

    return;

}

int main()

{

    string s;

    cin>>s;

    n=s.size();

    for(int i=0;i<n;i++)

    {

        string t;

        for(int j=i;j<n;j++)

        {

            t.push_back(s[j]);

            num[i][j]=stoll(t);

        }

    }

    run(0,0);

    cout<<ans<<endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.3055071178773465x):
#include <cstdio>

#include <cstring>

char s[32];

int len,tong[32];

long long answer;

void charge(int dep,long long num,int cnt) {

	if(dep==len) {

		long long ans=num;

	//	printf("%d ",num);

		for(int i=cnt;i>=1;--i) {

			ans+=tong[i];

		//	printf("%d ",tong[i]);

		}

		//printf("\n");

		answer+=ans;

		return ;

	}

	tong[cnt+1]=num;

	charge(dep+1,s[dep]-'0',cnt+1);

	tong[cnt+1]=0;

	charge(dep+1,num*10+s[dep]-'0',cnt);

}

int main() {

	scanf("%s",s);

	len=strlen(s);

	answer=0;

	charge(0,0,0);

	printf("%lld\n",answer/2);

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>



using namespace std;



string str;

int n;



long long solve(vector <int> a) {

	int pos = 0;	

	long long ans = 0;

	for (int i = 0; i < (int)a.size(); i++) {

		long long sum = 0;

		for (int j = pos; j <= a[i]; j++) {

			sum = sum * 10 + (str[j] - '0');			

		}	

		pos = a[i] + 1;

		ans += sum;

	}

	long long sum = 0;

	for (int i = pos; i < n; i++) {

		sum = sum * 10 + (str[i] - '0');	

	}

	ans += sum;

	return ans;

}



int main() {

	cin >> str;

	n = str.size();

	long long ans = 0;

	for (int i = 0; i < (1 << (n - 1)); i++) {

		vector <int> pos;

		int cnt = 0;

		for (int j = 0; j < n; j++) {

			if (i & (1 << j)) {

				pos.push_back(j);

				cnt++;									

			}	

		}  

		ans += solve(pos);

	}

	cout << ans << endl;

	return 0;

}                     

// Faster C++ solution for the same problem (measured speedup: 5.313858046728861x):
#include <cstdio>

#include <cstring>

char s[32];

int len,tong[32];

long long answer;

void charge(int dep,long long num,int cnt) {

	if(dep==len) {

		long long ans=num;

	//	printf("%d ",num);

		for(int i=cnt;i>=1;--i) {

			ans+=tong[i];

		//	printf("%d ",tong[i]);

		}

		//printf("\n");

		answer+=ans;

		return ;

	}

	tong[cnt+1]=num;

	charge(dep+1,s[dep]-'0',cnt+1);

	tong[cnt+1]=0;

	charge(dep+1,num*10+s[dep]-'0',cnt);

}

int main() {

	scanf("%s",s);

	len=strlen(s);

	answer=0;

	charge(0,0,0);

	printf("%lld\n",answer/2);

	return 0;

}