#include #include #include using namespace std; typedef long long ll; const ll MOD = 1000 * 1000 * 1000 + 9; const ll MAX_M = 10000000000LL; const auto PRICE1 = 111111; int main() { int T; cin >> T; static vector dp(MAX_M / PRICE1 + 1, 0); dp[0] = 1; for (auto price = 1; price <= 9; price++) { for (auto use = 0; use < dp.size(); use++) { if (use - price < 0) continue; dp[use] += dp[use - price]; dp[use] %= MOD; } } while (T--) { ll M; cin >> M; ll ans = 0; for (auto use = 0; use <= M / PRICE1; use++) { ans += dp[use]; ans %= MOD; } cout << ans << endl; } return 0; }