
#include<bits/stdc++.h>
#define sz(x) ((int)(x).size())
#define rep(i,a,b) for (int i=(a); i<(b); i++)
#define per(i,a,b) for (int i=(b-1); i>=(a); i--)
#define debug(x) cout << #x << " => " << x << endl
using namespace std;

#define fi first
#define se second
#define mp make_pair
typedef pair<int,int> pii;

#define pb push_back
typedef vector<int> vi;

typedef long long ll;
typedef long double ld;

const int MAX_N = 7 + 100;
///----------------------------------------------
char str[MAX_N];
int pow2[MAX_N];
int val(int l,int r) {
	int ret=0;
	rep(i,l,r+1) ret=ret*10+str[i]-'0';
	return ret;
}
int main() {

	///init
	pow2[0]=1; rep(i,1,15) pow2[i]=(pow2[i-1]<<1);

	///read
	scanf(" %s",str); int len=strlen(str);

	///work
	ll ans=0;
	rep(l,0,len) rep(r,l,len) {
		ll tmp = pow2[l-(l>0)+len-1-r-(len-1-r>0)];
		ans += tmp*val(l,r); 
	}
	cout << ans;
	

}
