MOD = 10 ** 9 + 9 n = 10 ** 5 dp = [0] * (n + 1) dp[0] = 1 lst = [1] + list(range(1, 10)) for x in lst: for i in range(x, n + 1): dp[i] += dp[i - x] dp[i] %= MOD def solve(): m = int(input()) n = m // 111111 print(dp[n]) for _ in range(int(input())): solve()