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
#include <bits/stdc++.h>

using namespace std;


typedef long long LL;


LL digitSums(int x) {
	LL digs = 0;

	for (int i = 0; i < 10; ++i) {
		int r = x - i;

		if (0 <= r && r < 10)
			digs++;
	}

	return digs;
}


LL sums(LL n) {
	LL p = 1;
	LL q = 1;
	int f = -1;

	while (n > 0) {
		int d = n % 10;
		n /= 10;

		LL r = digitSums(d) * q;

		if (f >= 0 && d == 1)
			r += digitSums(f + d * 10) * p;

		p = q;
		q = r;
		f = d;
	}

	return q;
}


int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	LL n;
	cin >> n;

	cout << sums(n) << endl;
	
	return 0;
}