#include using namespace std; typedef long long ll; const int MOD = 1000000009; int main() { cin.tie(0); ios::sync_with_stdio(false); int t; cin >> t; for (int testcase = 0; testcase < t; testcase++) { ll tmp; cin >> tmp; tmp /= 111111; int m = (int)tmp; vector dp(m + 1, 0); dp[0] = 1; for (int i = 1; i <= 9; i++) { for (int j = 0; j <= m; j++) { if (i + j > m) continue; (dp[i + j] += dp[j]) %= MOD; } } int ans = 0; for (int i = 0; i <= m; i++) (ans += dp[i]) %= MOD; cout << ans << endl; } return 0; }