1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <cstdio>
#include <cstring>
using namespace std;

#define FORD(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define REPD(i,n) FORD(i,0,n)
#define STR(n,x) char x[n]; scanf("%s", x)

typedef long long LL;

LL res[20];

int main() {
	STR(20, a);
	int n = strlen(a);
	res[n] = 1;
	REPD(i,n) {
		res[i] = res[i + 1] * (a[i] - '0' + 1);
		if (a[i] == '1' && i < n - 1)
			res[i] += res[i + 2] * (9 - (a[i + 1] - '0'));
	}
	printf("%lld\n", res[0]);
}