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

using namespace std;


long long count(string digits)
{
	if(digits.size() == 2 && digits[0] == '0')
		return 0;

	long long c = 0;
	long long N = stoi(digits);
	for(long long i = 0; i < 10; i++)
	{
		if(N - i >= 0 && N - i < 10)
			c++;
	}
	return c;
}
void solve()
{
	string N; cin >> N;
	long long solutions[2] = {1, 1};
	for(int i = 0; i < N.size(); i++)
	{
		string C1 = "";
		C1 += N[i];
		string C2;
		if(i > 0)
			{C2 += N[i - 1];C2 += C1;}
		
		long long s1 = solutions[1];
		long long s2 = solutions[0];
		
		long long c1 = count(C1) * s1;
		long long c2 = 0;

		if(i > 0)
			c2 = count(C2) * s2;
		
		solutions[0] = solutions[1];
		solutions[1] = c1 + c2;
	}
	cout << solutions[1] << '\n';
}

int main()
{
	solve();
}