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
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int _n=(n), i=0;i<_n;++i)
#define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i)
#define FORD(i,a,b) for(int i=(a),_b=(b);i>=_b;--i)
#define TRACE(x) cerr << "TRACE(" #x ")" << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << endl;
typedef long long LL; typedef unsigned long long ULL;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  LL input; cin >> input;
  string digits = to_string(input);
  for (char &d : digits) d -= '0';
  const int n = digits.size();
  vector<LL> res(n+1);
  res[0] = 1;
  FOR(len, 1, n) {
    res[len] = res[len-1] * (digits[len-1]+1);
    if(len>=2 && digits[len-2]==1) {
      res[len] += res[len-2] * (9-digits[len-1]);
    }
  }
  cout << res[n] << '\n';
}