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
51
52
53
54
55
56
57
58
#include <cstdio>


int tab[20];

long long s = 0;

void calc(long long n, long long ret)
{
  //printf("n = %lld ret = %lld\n", n, ret);
  if (n == 0) 
  {
    s += ret;
    return;
  }
  
  int r = n % 10;
  int rr = n % 100;
  
  calc(n / 10, ret * tab[r]);
  if (rr > 9 && rr < 19)
    calc(n / 100, ret * tab[rr]);
}


int main()
{
  long long n;
  scanf("%lld", &n);
  
  tab[0] = 1;
  tab[1] = 2;
  tab[2] = 3;
  tab[3] = 4;
  tab[4] = 5;
  tab[5] = 6;
  tab[6] = 7;
  tab[7] = 8;
  tab[8] = 9;
  tab[9] = 10;
  tab[10] = 9;
  tab[11] = 8;
  tab[12] = 7;
  tab[13] = 6;
  tab[14] = 5;
  tab[15] = 4;
  tab[16] = 3;
  tab[17] = 2;
  tab[18] = 1;
  
  
  long long ret = 1;
  calc(n, ret);
  
  printf("%lld\n", s);
  
  return 0;
}