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 <cstdint>
#include <iostream>
#include <string>
#include <vector>

#define n(x) (x + 1)

struct State {
    int64_t finished, unfinished;
    int64_t acc;
};

std::ostream& operator<<(std::ostream& os, State s) {
    os << s.finished << " " << s.unfinished << " " << s.acc;
}

uint64_t solve(int64_t x) {
    State last{1, 1, -1}, current{0, 0, -1};

    while(x > 0) {
        int64_t z = x % 100;
        x/=10;
        if (z >= 19) {
            current.acc = -1;
        } else {
            current.acc = (18 - z);
        }
        current.finished = last.finished * n(z % 10) + last.unfinished * n(last.acc);
        current.unfinished = last.finished;
        //std::cerr << z << " " << x << "->" <<  current << std::endl;
        std::swap(current, last);
    }
    return last.finished;
}

int main() {
    int64_t s;

    std::cin >> s;
    std::cout << solve(s) << std::endl;
}