using namespace std; const int mod=1e9+7; typedef long long ll; ll qpow(ll a,ll b){ ll ans=1; while(b){ if(b&1) ans=(ans*a)%mod; a=(a*a)%mod; b=b>>1; } return ans; } ll inv(ll a){ return qpow(a,mod-2); } ll Cmod(ll a,ll b) { return (a*inv(b))%mod; } int main() { int t;cin>>t; while(t--){ ll n;cin>>n; ll a=n,b=qpow(2,n-1); ll node=gcd(a%mod,b); cout<<Cmod(a%mod/node,b/node)<<endl; } }
include