#define _USE_MATH_DEFINES #include #include #include #include #include //#include #include #include #include #include #include #include ///////// #define REP(i, x, n) for(int i = x; i < n; i++) #define rep(i,n) REP(i,0,n) #define P(p) cout<<(p)< ///////// typedef long long LL; typedef long double LD; ///////// using namespace::std; ///////// const int mod = 9+(int)1e9; LL ans[10000]; const int dpmax = 100000; LL dp[10][dpmax+1]; int main(void){ std::cin.tie(0); std::ios::sync_with_stdio(false); std::cout << std::fixed;// //cout << setprecision(16);// int T;cin>>T; LL M; for(int i=0;i<=dpmax;++i){ if(i-2>=0){ dp[2][i] = (dp[2][i-2] + i + 1)%mod; }else{ dp[2][i] = i + 1; } } for(int k=3;k<=9;++k) { for(int i=0;i<=dpmax;++i){ if(i-k>=0){ dp[k][i] = (dp[k][i-k] + dp[k-1][i])%mod; }else{ dp[k][i] = dp[k-1][i]; } } } rep(i,T){ cin>>M; M /= 111111; ans[i] = dp[9][M]; } rep(i,T){ if(ans[i]){ P(ans[i]); }else{ P(1); } } return 0; }