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

long long t[30];

long long rek(long long x)
{
    if(x==0)return 1;
    if(x%100 <= 18 && x%100 >= 10)
    {
        return t[x%100]*rek(x/100) + t[x%10]*rek(x/10);
    }
    return t[x%10]*rek(x/10);
}

int main()
{
    t[0] = 1;
    t[1] = 2;
    t[2] = 3;
    t[3] = 4;
    t[4] = 5;
    t[5] = 6;
    t[6] = 7;
    t[7] = 8;
    t[8] = 9;
    t[9] = 10;
    t[10] = 9;
    t[11] = 8;
    t[12] = 7;
    t[13] = 6;
    t[14] = 5;
    t[15] = 4;
    t[16] = 3;
    t[17] = 2;
    t[18] = 1;
    long long n;
    cin >> n;
    cout << rek(n);
    return 0;
}