// yukicoder: No.41 貯金箱の溜息(EASY) // 2019.6.22 bal4u #include typedef long long ll; #if 1 #define gc() getchar_unlocked() #define pc(c) putchar_unlocked(c) #else #define gc() getchar() #define pc(c) putchar(c) #endif ll in() { // 非負整数の入力 ll n = 0; int c = gc(); do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0'); return n; } void out(int n) { // 非負整数の表示(出力) int i; char b[20]; if (!n) pc('0'); else { i = 0; while (n) b[i++] = n % 10 + '0', n /= 10; while (i--) pc(b[i]); } pc('\n'); } #define MOD 1000000009 #define LIM 90000 int dp[LIM+20]; int s[LIM+20]; int main() { int i, j, T, M; dp[0] = 1; for (i = 1; i < 10; i++) { for (j = 0; j <= LIM; j++) dp[j+i] = (dp[j+i] + dp[j]) % MOD; } for (i = 0; i <= LIM; i++) s[i+1] += (s[i] + dp[i]) % MOD; T = (int)in(); while (T--) { M = (int)(in() / 111111); out(s[M+1]); } return 0; }