import std.stdio; import std.array; import std.string; import std.conv; import std.algorithm; import std.typecons; import std.range; import std.random; import std.math; import std.container; import std.numeric; import std.bigint; long mod = 10L^^9+9; void solve(string S, ref long[][][] dp) { auto N = S.length; dp = new long[][][](N+1, 2, 1820); // keta, miman, 3wareru, 3tsuku, 8wareru dp[0][0][0] = 1L; foreach (i; 0..N) foreach (j; 0..2) foreach (k; 0..1801) { auto digit = j ? 9 : (S[i]-'0').to!int; foreach (d; 0..digit+1) (dp[i+1][j||(d