import std.stdio;
import std.conv, std.array, std.algorithm, std.string;
import std.math, std.random, std.range, std.datetime;
import std.bigint;
import std.container;
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }

void main(){
	long d = read.to!long;
	
	long[][] xss = [
		[        10 - 1],
		[       100 - 1,        10 - 10],
		[      1000 - 1,       100 - 10],
		[     10000 - 1,      1000 - 10,      100 - 100],
		[    100000 - 1,     10000 - 10,     1000 - 100],
		[   1000000 - 1,    100000 - 10,    10000 - 100,    1000 - 1000],
		[  10000000 - 1,   1000000 - 10,   100000 - 100,   10000 - 1000],
		[ 100000000 - 1,  10000000 - 10,  1000000 - 100,  100000 - 1000,  10000 - 10000],
		[1000000000 - 1, 100000000 - 10, 10000000 - 100, 1000000 - 1000, 100000 - 10000]
		];
	
	long ans;
	foreach(xs; xss){
		ans += count(xs, d);
		}
	
	ans.writeln;
	
	}

bool isPossible(long[] xs, long d){
	foreach(x; xs) if(x > 0) if(d / x <= 9) d %= x;
	if(d > 0) return false;
	debug writeln(xs, " is possible");
	return true;
	}

long count(long[] xs, long d){
	if(!isPossible(xs, d)) return 0;
	long res = 1;
	foreach(i, x; xs){
		if(x == 0) res *= 10;
		else{
			res *= (i? 10: 9) - d / x;
			d %= x;
			}
		}
	debug writeln(res);
	return res;
	}

