1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// Author: Kamil Nizinski
#ifdef LOCAL
#ifdef COLOR
#include "bits/cp_local_color.h"
#else
#include "bits/cp_local.h"
#endif
#else
#include "bits/stdc++.h"
#define debug_arr(arr_name, first, last)
#define debug(...)
#define cerr if (false) cerr
#define speed_of_cin_and_cout ios_base::sync_with_stdio(0), cin.tie(0)
#define local if (false)
#endif
#define ft first
#define sd second
#define psb push_back
#define sz(a) (static_cast<int>((a).size()))
using namespace std;
typedef int64_t LL;
typedef uint64_t LLU;
typedef long double LD;
typedef pair<int, int> PII;
// string to_string(__int128 x) {
//   string result;
//   LL first_part = static_cast<LL>(x >> 64);
//   if (first_part != LL{0}) result = to_string(static_cast<LL>(x >> 64));
//   result += to_string(static_cast<LL>((x << 64) >> 64));
//   return result;
// }
void solve() {
  string n;
  getline(cin, n);
  reverse(begin(n), end(n));
  LLU result = LLU{0};
  for (int mask = 0; mask < (1 << (sz(n) - 1)); mask++) {
    LLU partial_result = LLU{1};
    int i;
    for (i = 0; i < sz(n); i++) {
      if (mask & (1 << i)) {
        if (mask & (1 << (i + 1)) || n[i + 1] != '1' || n[i] == '9') break;
        partial_result *= '9' - n[i];
        i++;
      } else {
        partial_result *= n[i] - '0' + 1;
      }
    }
    if (i == sz(n)) {
      debug(ULLONG_MAX - result, partial_result);
      local if (ULLONG_MAX - result < partial_result) cerr << "Too much!\n";
      result += partial_result;
    }
  }
  cout << to_string(result) << "\n";
}

int main() {
  speed_of_cin_and_cout;
  debug(ULLONG_MAX);
  debug(LLONG_MIN);
  debug(LLONG_MAX);
  int test_cases_num = 1;
//   cin >> test_cases_num;
  for (int i = 1; i <= test_cases_num; i++) {
    local if (test_cases_num > 1) cerr << "Test #" << i << ":\n";
    solve();
    local if (test_cases_num > 1) cerr << "End of test #" << i << ".\n";
  }
  return 0;
}