#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define pb push_back
#define ii pair<ll, ll>
#define all(a) a.begin(), a.end()
#define iii pair<ii, ll>
#define ld long double
using namespace std;
const ll N = 2e2+5;
const ll mod = 1e9+7;
const ll inf=4e18+3;
const ll lg =18;
ll n,i,j,m,q,k,t;
ll x,y;
ll a[N],f[N],r[N];
ll mu(ll a,ll b)
{
if(b==0) return 1;
if(b==1) return a%mod;
ll res=mu(a,b/2);
res=res*res%mod;
if(b&1) res=res*a%mod;
return res;
}
vector<ll>ans={0,666666672,571428577,733333341,548387104,285714292,401574811,54901967,305283766,687194538,930630205,637851051,269564167,48220727,68575102,889417886,481716032,687056319,954051904,121547830,239217412,999114059,498264988,847103550,758761690,638522568,268899203,802375319,911887665,665647523,347470132,249948686,415505300,293580916,631099079,133397470,179641631,908225308,735415978,370496430,925361906,675702668,992844490,586790472,486337579,425150383,664592138,914789996,772456654,799879782,899195971,337434977,870849620,429060808,261158658,304825485,495778058,172841730,550803456,621379872,825247430,195174391,149707164,550237255,434017081,508502652,962252350,486033940,216956820,610127529,961466989,549906267,367921647,594964096,276698183,809717020,81528533,744656687,495311643,866954358,131441158,314370724,170132716,983933855,527513392,632834937,675660064,315749494,839731414,530949465,942829728,529725350,821306848,967466098,781228030,679039065,653977477,841867588,406101445,671916196,154660144,128303839,221224696,920685660,777084320,395430897,335136412,722644706,248891204,504457951,775248161,349796576,74857969,729964279,978279169,389616934,164479112,89793646,423460149,696236474,176676045,551082477,893614131,639796232,446656698,526261967,295038330,825220882,697866216,976082617,768952803,186815674,165986386,93773490,612773827,898380343,779578186,193016194,874516626,157110604,717223381,49756112,567353074,424486813,131235898,255307387,787070716,98378846,995605722,755309723,411918937,600100782,17321362,303222205,182246766,997171493,175600679,674410914,278528097,212497643,589944900,543573141,930376920,689938960,112006801,328572912,195606533,586277662,109153634,745980494,286667447,755139031,497350598,973905391,639723549,304170631,807244845,773061231,904529395,143673214,815431486,612568341,523953553,447605849,799432615,627312407,576033339,821063613,794958645,872059132,108593592,610831908,75896678,83678274,526936897,632317225,178730200,941861036,866083134,463189473}
;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
cin>>q;
while(q--)
{
cin>>n;
if(n<=200) cout<<ans[n-1]<<'\n';
/// n=2^k-1
}
return 0;
}
/*
(2^d-1)*(2^k) / (2^n-1)
2^d+k-n - 2^k-n
*/
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |