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;
typedef vector<int> VI;
typedef pair <int,int> ii;
typedef long long LL;
#define pb push_back
const int INF = 2147483647;

LL n, res[22];
int ind, tab[22], i;

int main() {
scanf("%lld", &n);
ind = 1;
while (n > 0) {
	tab[ind++] = n % 10;
	n /= 10;
}
res[0] = 1;
for (i=1;i<ind;i++) {
	res[i] = res[i - 1] * (tab[i] + 1);
	if (i > 1 && tab[i] == 1) res[i] = (res[i] + res[i - 2] * (9 - tab[i - 1]));
}
printf("%lld\n", res[ind - 1]);
return 0;
}