#include using namespace std; template Value unboundedKnapsack(const vector& maxWeight, const vector& weight, const vector& value) { constexpr Value IMP = numeric_limits::min() + 1; const Weight mx = *max_element(maxWeight.begin(), maxWeight.end()); vector dp(mx + Weight(1)); if (strict) fill(dp.begin() + 1, dp.end(), IMP); for (size_t i = 0; i < weight.size(); ++i) { for (int w = 0; w <= mx; ++w) { if (strict && dp[w] == IMP) continue; Weight ww = Weight(w) + weight[i]; Value vv = dp[w] + value[i]; if (ww <= mx && dp[ww] < vv) dp[ww] = vv; } } Value res = 0; for (const auto& w : maxWeight) { if (dp[w] == IMP) return IMP; res += dp[w]; } return res; } template Value unboundedKnapsack(Weight maxWeight, const vector& weight, const vector& value) { return unboundedKnapsack({maxWeight}, weight, value); } template vector unboundedKnapsackCount(Weight maxWeight, const vector& weight) { vector dp(maxWeight + Weight(1)); dp[0] = 1; for (auto& w : weight) { for (int i = 0; i <= maxWeight; ++i) { Weight ww = Weight(i) + w; if (ww <= maxWeight) dp[ww] += dp[i]; } } return dp; } template vector unboundedKnapsackFill(Weight maxWeight, const vector& weight) { vector dp(maxWeight + Weight(1)); dp[0] = true; for (auto& w : weight) { for (int i = 0; i <= maxWeight; ++i) { Weight ww = Weight(i) + w; if (ww <= maxWeight && dp[i]) dp[ww] = true; } } return dp; } namespace arithmetic { template class Addition { public: template T operator+(const V& v) const { return T(static_cast(*this)) += v; } }; template class Subtraction { public: template T operator-(const V& v) const { return T(static_cast(*this)) -= v; } }; template class Multiplication { public: template T operator*(const V& v) const { return T(static_cast(*this)) *= v; } }; template class Division { public: template T operator/(const V& v) const { return T(static_cast(*this)) /= v; } }; template class Modulus { public: template T operator%(const V& v) const { return T(static_cast(*this)) %= v; } }; } template class IndivisibleArithmetic : public arithmetic::Addition, public arithmetic::Subtraction, public arithmetic::Multiplication {}; template class Arithmetic : public IndivisibleArithmetic, public arithmetic::Division {}; class Inverse { private: long long mod; vector inv; public: Inverse() {} Inverse(long long mod, long long n = 1000000) : mod(mod) { inv = vector(n, 1); for (int i = 2; i < n; ++i) inv[i] = inv[mod % i] * (mod - mod / i) % mod; } long long operator()(long long a) const { if (a < (int)inv.size()) return inv[a]; long long b = mod, x = 1, y = 0; while (b) { long long t = a / b; swap(a -= t * b, b); swap(x -= t * y, y); } return (x %= mod) < 0 ? x + mod : x; } }; class Mint : public Arithmetic { private: static long long mod; static Inverse inverse; long long val; public: Mint() : val(0) {} Mint(const long long& val) { this->val = val % mod; if (this->val < 0) this->val += mod; } static void setMod(const long long& m) { mod = m; inverse = Inverse(m); } Mint operator+=(const Mint& m) { val += m.val; if (val >= mod) val -= mod; return *this; } Mint operator-=(const Mint& m) { val -= m.val; if (val < 0) val += mod; return *this; } Mint operator*=(const Mint& m) { val *= m.val; val %= mod; return *this; } Mint operator/=(const Mint& m) { val *= inverse(m.val); val %= mod; return *this; } Mint operator++() {return val += 1;} Mint operator--() {return val -= 1;} operator long long() { return val; } Mint identity() const { return 1; } }; long long Mint::mod = 1000000007; Inverse Mint::inverse(1000000007); ostream& operator<<(ostream& os, Mint a) { os << (long long)a; return os; } istream& operator>>(istream& is, Mint& a) { long long n; is >> n; a = n; return is; } int main() { Mint::setMod(1000000009); vector w(9); iota(w.begin(), w.end(), 1); auto v = unboundedKnapsackCount(100000, w); int t; cin >> t; for (int i = 0; i < t; ++i) { long long m; cin >> m; Mint res = 0; for (int j = 0; j <= m / 111111; ++j) res += v[j]; cout << res << endl; } }