#include "bits/stdc++.h" #define REP(i, n, N) for(ll i=(n); i<(N); i++) #define RREP(i, n, N) for(ll i=(N-1); i>=n; i--) #define CK(n, a, b) ((a)<=(n)&&(n)<(b)) #define ALL(v) (v).begin(),(v).end() #define p(s) cout<<(s)<> typedef long long int ll; using namespace std; const ll mod = 1e9 + 9; const ll inf = 1e18; ll dp[90010]; int main() { int T; cin >> T; REP(i, 0, 90001) dp[i] = 1; REP(j, 1, 10) { REP(i, 0, 90001) { (dp[i + j] += dp[i]) %= mod; } } REP(i, 0, T) { ll a; cin >> a; a /= 111111; p(dp[a]); } }