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



int main(void){
  
string S;
cin>>S;
int N=S.size();
long long ans=0;
for(int bit=0;bit<(1<<(N-1));bit++){
string SS="";
 for(int i=0;i<N;i++){
     SS+=S[i];
  if(bit&(1<<i)){
   ans+=stol(SS);
   SS="";
  }
 }
 ans+=stol(SS);
 SS="";
}
 cout<<ans<<endl;   
}