import std; void main () { string n = readln.chomp; auto N = new int[](n.length); foreach (i, c; n) N[i] = c - '0'; solve(N); } void solve (int[] N) { const long MOD = 998244353; const int len = N.length.to!int; long[Tuple!(int, int, bool, bool)] memo; long dp (int i, int set, bool has, bool less) { auto key = tuple(i, set, has, less); if (key in memo) return memo[key]; if (i == len) { if (has && set == 0) return 1; return 0; } long res = 0; foreach (nex; 0..10) { if (!less && N[i] < nex) continue; int st = set; if (has || 0 < nex) st ^= (1 << nex); bool h = has || 0 < nex; bool l = less || nex < N[i]; res += dp(i + 1, st, h, l); res %= MOD; } return memo[key] = res; } writeln(dp(0, 0, false, false)); }