#include "bits/stdc++.h" using namespace std; #define int long long #define REP(i, n) for(int i=0; i<(n); i++) #define MAX (int)1e6 int N,T,M; int dp[MAX+100]; int mod = 1e9 + 9; signed main() { cin >> T; REP(_i,9) { int i = _i+1; REP(k,MAX) { dp[k+i] += dp[k] + 1; dp[k+i] %= mod; } } REP(_,T) { cin >> M; cout << dp[M / 111111] + 1 << endl; } return 0; }