#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
  string s;
  cin >> s;
  ll ans = 0, l = (ll)pow(2,s.size());
  for(ll i=s.size()-1;i>=0;i--){
    ans += l * (s[i]-'0');
    l = (l*10 + (1<<s.size()))/2;
  }
  cout << ans/2 << endl;
}
