#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  long long answer = 0;
  for (int i = 0; i < (1 << (S.length()-1)); i++) {
    long long sum = 0;
    for (int j = 0; j < S.length(); j++) {
      sum *= 10;
      sum += S[j]-'0';
      if ((1 << j) & i || j == S.length()-1) {
        answer += sum;
        sum = 0;
      }
    }
  }
  cout << answer;
}