#include <cstdio>
#include <cstring>

#define maxn 1000 + 8

using namespace std;

typedef unsigned long long ll;

int n;
char s[maxn];
ll f[maxn][maxn],res;

void figure(int pos,ll num) {
	if (pos>=n) res+=num;
	for (int i=pos;i<n;++i) figure(i+1,num+f[pos][i]);
}

int main() {
	while (scanf("%s",s)==1) {
		n=strlen(s);
		res=0llu;
		for (int i=0;i<n;++i) {
			f[i][i]=ll(s[i]-'0');
			for (int j=i+1;j<n;++j)
				f[i][j]=f[i][j-1]*10llu+ll(s[j]-'0');
		}
		figure(0,0llu);
		printf("%llu\n",res);
	}
	return 0;
}