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
#include<cstdio>
#include<iostream>
using namespace std;

int options[20];

void count_options() {
	for (int i = 0; i <= 9; i++) {
		options[i] = i + 1;
	}
	for (int i = 10; i <= 18; i++) {
		options[i] = 19 - i;
	}
}

long long int count(string sum) {
	if (sum.length() == 0) {
		return 1;
	}
	if (sum.length() == 1) {
		int a = sum[0]-int('0');
		return options[a];
	} 
	int a = sum[0]-int('0');
	int b = sum[1]-int('0');
	if (a == 1 && b <= 8) {
		long long int x = options[a]*count(sum.erase(0, 1)) + options[a*10+b]*count(sum.erase(0, 1));
		return x;
	} else {
		return options[a]*count(sum.erase(0, 1));
	}
	
}


int main() {
	ios_base::sync_with_stdio(0);
	string s;
	cin >> s;
	
	count_options();
	cout << count(s);
	
	return 0;
}