#include #define rep(i,n) for(int i=ZERO;i<(n);i=add(i,ONE)) using namespace std; const int ZERO=false; const int ONE=true; const int TWO=ONE<0){ return add(a^b,(a&b)<=0) return add(b,a); else return add(~add(add(~a,ONE),add(~b,ONE)),ONE); } } int sub(int a,int b){ return add(a,add(~b,ONE)); } int modadd(int a,int b){ if(a=MOD) a=sub(a,MOD); if(b=MOD) b=sub(b,MOD); int res=add(a,b); if(res=MOD) res=sub(res,MOD); return res; } int modmul(int a,int b){ return b==ZERO?ZERO:modadd(modmul(a,b>>ONE)<>k; for(;k>ZERO;k>>=ONE){ if(k&ONE) modmul(B,A,B); modmul(A,A,A); } cout<>q; rep(_,q) solve(); return ZERO; }