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

using namespace std;

typedef long long LL;

LL f(LL a) {
    if (!a) return 1;
    int m = a%10;
    a/=10;
    LL ret = (m+1)*f(a);
    if (a) {
        int m2 = a%10;
        int c = m2*10+m;
        if (c<19 &&c>9) {
            ret += (19 - c) * f(a/10);
        }
    }
    return ret;
}

int main()
{
    LL n;
    scanf("%lld", &n);
    printf("%lld\n", f(n));
    return 0;
}