#include<bits/stdc++.h>#defineendl'\n'#defineintlonglongconstint MOD =1e9+7;usingnamespace std;constint MAX =1000000+10;// 1e6 + 10longlong fact[MAX], inv_fact[MAX];longlongpow_mod(longlong a,longlong b){longlong res =1;while(b >0){if(b &1)
res = res * a % MOD;
a = a * a % MOD;
b >>=1;}return res;}voidprecompute(){
fact[0]=1;for(int i =1; i < MAX;++i){
fact[i]= fact[i -1]* i % MOD;}
inv_fact[MAX -1]=pow_mod(fact[MAX -1], MOD -2);for(int i = MAX -2; i >=0;--i){
inv_fact[i]= inv_fact[i +1]*(i +1)% MOD;}}longlongcomb(int a,int b){if(b <0|| b > a)return0;return fact[a]* inv_fact[b]% MOD * inv_fact[a - b]% MOD;}voidsolve(){// comb(n,m);}signedmain(){precompute();int T =1;
cin >> T;while(T--){solve();}return0;}
模逆元
// 使用费马小定理计算模逆元(要求mod为质数)。typedeflonglong ll;const ll mod =1e9+7;
ll mod_pow(ll a, ll b, ll mod){
ll res =1;while(b){if(b &1)
res = res * a % mod;
a = a * a % mod;
b >>=1;}return res;}
ll mod_inverse(ll x){returnmod_pow(x, mod -2, mod);}
//扩展欧几里得算法,不需要mod为质数voidextend_gcd(ll a, ll b, ll &d, ll &x, ll &y){if(b ==0){
x =1;
y =0;
d = a;return;}extend_gcd(b, a % b, d, x, y);
ll tmp = x;
x = y;
y = tmp - a / b * y;}
ll mod_reverse(ll y, ll p){
ll x, d;extend_gcd(y, p, d, x, y);return d ==1?(p + x % p)% p :-1;}