//
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int MOD=1e9+7;
int fastpow( int in,int n )
{
int ans=1;
while( n )
{
if( n&1 ) ans=ans*in%MOD;
in=in*in%MOD;
n>>=1;
}
return ans;
}
signed main()
{
int t,n; cin>>t;
while( t-- )
{
cin>>n; cout<<fastpow( n,MOD-2 )<<endl;
}
return 0;
}