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


long int solve(long int n) {	
	long int single_digit_comb=n%10+1;
	long int double_digits_comb=0;
	long int total=0;
	int last_2_digits=n%100;
	if(10 <= last_2_digits && last_2_digits <= 18)
		double_digits_comb=19-last_2_digits;
	long int del_1_digit=n/10;
	if(del_1_digit>0)
		total += solve(del_1_digit) * single_digit_comb;
	else
		total += single_digit_comb;
	long int del_2_digits=n/100;
	if(del_2_digits>0)
		total += solve(del_2_digits) * double_digits_comb;
	else
		total += double_digits_comb;
	return total;
}


int main() {
	long int n;
	cin >> n;
	cout << solve(n) << endl;

	return 0;
}