T = int(input()) lsT = [int(input()) for i in range(T)] mod = 10**9+9 lsM = [0]*(10**5+100) lsM[0] = 1 for i in range(1,10): for j in range(10**5): lsM[i+j] += lsM[j] lsM[i+j] %= mod for i in range(1,10**5): lsM[i] += lsM[i-1] lsM[i] %= mod for i in range(T): k = lsT[i]//111111 print(lsM[k])