1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <iostream>
#include <vector>
#include <cmath>
#include <set>
#include <string>


int main()
{
    std::string g;
    std::cin >> g;
    std::vector<long long int> f(g.size(), 0);
    f.push_back(1);
    g.push_back('9');
    for (int i = g.size()-2; i>=0; --i)
    {
        long long int tmp = (int(g[i]) - 47) * f[i+1];
        if (g[i] == '1' && g[i+1] < '9')
            tmp += f[i+2] * (9 - (int(g[i+1]) - 48));
        f[i] = tmp;
    }
    std::cout << f[0] << std::endl;
    return 0;
}