#include "algorithm"
#include "array"
#include "cmath"
#include "complex"
#include "cstdio"
#include "deque"
#include "initializer_list"
#include "map"
#include "numeric"
#include "queue"
#include "regex"
#include "set"
#include "stack"
#include "string"
#include "unordered_map"
#include "vector"
#define FOR(i, n) for ((i) = 0; (i) < (n); ++(i))
#define in_int(x) scanf(" %d/n", &(x));
#define in_str(x) scanf(" %[a-zA-Z (+-0-9_) #.]/n", (x));
#define ch(x) printf("debag %d\n", (x))

int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, -1, 1};
int dx_ar[] = {-1, -1, -1, 0, 0, 1, 1, 1};
int dy_ar[] = {1, 0, -1, 1, -1, 1, 0, -1};

template <typename type> void print_array_horizon(type d1_arr);
template <typename type> void print_2darray(type d2_arr);
std::vector<std::vector<int>> padding(std::vector<std::vector<int>> arr,
                                      int pad);
inline std::vector<int> str_int_split(char *s);
inline std::vector<std::vector<int>> in_d2_arr(int N, int size = 1000);
inline std::vector<int> in_d1_arr(int size = 1000);
inline double d2_distance(int x1, int y1, int x2, int y2);
inline int d2_manhattan(int x1, int y1, int x2, int y2);
long long dp[50][1000000] = {{}};

std::vector<std::vector<int>> bit_flag(int choice_num) {
  std::vector<std::vector<int>> out;
  for (int i = 1; i < pow(2, choice_num); ++i) {
    std::vector<int> v;
    for (int j = 0; j < choice_num; ++j) {
      if ((i >> j) & 1) {
        v.push_back(j);
      }
    }
    out.push_back(v);
  }
  return out;
}

int main() {
  char x[100];
  in_str(x);
  int i, mul;
  long long out = 0;
  std::string str = x;
  int size = str.size();
  long long f = atoll(x);
  std::reverse(str.begin(), str.end());
  std::vector<std::vector<int>> v = bit_flag(size - 1);

  for (auto vec : v) {
    i = 0;
    mul = 1;
    while (i != size) {
      out += long(str[i] - 48) * mul;
      mul = mul * 10;
      i += 1;
      for (auto nn : vec) {
        if (nn == i - 1) {
          mul = 1;
          break;
        }
      }
    }
  }
  printf("%lld\n", out + f);
}

template <typename type> void print_array_horizon(type d1_arr) {
  int i;
  FOR(i, d1_arr.size() - 1) { printf("%d ", d1_arr[i]); }
  printf("%d\n", d1_arr.back());
  fflush(stdout);
}

template <typename type> void print_2darray(type d2_arr) {
  int i, j;
  FOR(i, d2_arr.size()) {
    FOR(j, d2_arr[i].size() - 1) { printf("%d ", d2_arr[i][j]); }
    printf("%d\n", d2_arr[i].back());
    fflush(stdout);
  }
}

std::vector<std::vector<int>> padding(std::vector<std::vector<int>> arr,
                                      int pad) {
  std::vector<std::vector<int>> arr_c = arr;
  int height = arr_c.size();
  int width = arr_c[0].size();
  std::vector<int> v;
  v.resize(width);
  fill(v.begin(), v.end(), pad);
  arr_c.insert(arr_c.begin(), v);
  arr_c.push_back(v);
  int i;
  FOR(i, height + 2) {
    arr_c[i].insert(arr_c[i].begin(), pad);
    arr_c[i].resize(width + 2);
  }
  arr_c.shrink_to_fit();
  return arr_c;
}

inline std::vector<int> str_int_split(char *s) {
  char *tok = strtok(s, " ");
  std::vector<int> v;
  while (tok != NULL) {
    v.push_back(atoi(tok));
    tok = strtok(NULL, " "); /* 2回目以降 */
  }
  return v;
}

inline std::vector<std::vector<int>> in_d2_arr(int N, int size) {
  int i;
  std::vector<std::vector<int>> v;
  FOR(i, N) {
    char *lines;
    lines = new char[size];
    in_str(lines);
    v.push_back(str_int_split(lines));
    delete[] lines;
  }
  return v;
}

inline std::vector<int> in_d1_arr(int size) {
  std::vector<int> v;
  char *lines;
  lines = new char[size];
  in_str(lines);
  v = str_int_split(lines);
  delete[] lines;
  return v;
}

inline double d2_distance(int x1, int y1, int x2, int y2) {
  return sqrt(pow((x2 - x1), 2) + pow((y2 - y1), 2));
}

inline int d2_manhattan(int x1, int y1, int x2, int y2) {
  return (abs(x2 - x1) + abs(y2 - y1));
}


Measured memory_bytes: 256