#include #include #include #include #include #include #include #include #include #define repd(i,a,b) for (int i=(a);i<(b);i++) #define rep(i,n) repd(i,0,n) #define MOD 1000000009 #define NUM 1000000 typedef long long ll; using namespace std; int inputValue(){ int a; cin >> a; return a; }; void inputArray(int * p, int a){ rep(i, a){ cin >> p[i]; } }; void inputVector(vector * p, int a){ rep(i, a){ int input; cin >> input; p -> push_back(input); } } template void output(T a, int precision) { if(precision > 0){ cout << setprecision(precision) << a << "\n"; } else{ cout << a << "\n"; } } ll dp[NUM] = {0}; ll sum[NUM] = {0}; ll mod = MOD; int main(int argc, const char * argv[]) { // source code dp[0] = 1; rep(i, 9){ rep(j, NUM){ if (j > i) { dp[j] = dp[j] + dp[j - i - 1]; if (dp[j] >= mod) { dp[j] -= mod; } } } } sum[0] = 1; repd(i, 1, NUM){ sum[i] = sum[i - 1] + dp[i]; if (sum[i] >= mod) { sum[i] -= mod; } } int T = inputValue(); rep(i, T){ ll q = inputValue(); q /= 111111; output(sum[(int)q], 0); } return 0; }