//by Vanjape Rajas Mangesh
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> II;
typedef vector< II > VII;
typedef vector<int> VI;
typedef vector< VI > VVI;
typedef long long int LL;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define SET(a,b) memset(a,b,sizeof(a))
#define si(n) scanf("%d",&n)
#define dout(n) printf("%d\n",n)
#define sll(n) scanf("%lld",&n)
#define lldout(n) printf("%lld\n",n)
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
//FILE *fin = freopen("in","r",stdin);
//FILE *fout = freopen("out","w",stdout);
const int N=2000005;
const int M=100000000;
const int K=30;
const LL MOD=1000000007;
VI prim[N];
int vis[N];
LL fact[K],invfact[K];
LL powmod(LL a,LL b)
{
if(b==0)
return 1;
LL ret=powmod(a,b/2);
ret=(ret*ret)%MOD;
if(b%2==1)
{
ret=(ret*a)%MOD;
}
return ret;
}
LL ncr(int n,int r)
{
LL ret=1;
if(n>=(int)MOD)
return 0;
for(int i=0;i<r;i++)
{
ret=(ret*1LL*(n-i))%MOD;
}
ret=(ret*invfact[r])%MOD;
return ret;
}
void pre()
{
for(int i=2;i<N;i++)
if(!vis[i])
for(int j=i;j<N;j+=i)
{
vis[j]=1;
prim[j].PB(i);
}
fact[0]=1ll;
invfact[0]=1;
for(int i=1;i<K;i++)
{
fact[i]=(fact[i-1]*1LL*i)%MOD;
invfact[i]=powmod(fact[i],MOD-2);
}
return;
}
int main()
{
fast_io;
pre();
int t;
cin>>t;
while(t--)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