#include #include using namespace std; template struct prefix_binomial_sum { prefix_binomial_sum(int n):size(n),b(0){} mint get(int n, int k) { build(); int m=n/b; mint res=table[m][k]; m*=b; while(mfac,finv; vector>table; mint binom(int n, int k){return n0)return; b=int(sqrtl(size)); fac.resize(size+1); finv.resize(size+1); table.resize(b,vector(size+1)); fac[0]=1; for(int i=1;i<=size;i++)fac[i]=i*fac[i-1]; finv[size]=fac[size].inv(); for(int i=size;i>=1;i--)finv[i-1]=i*finv[i]; for(int i=0;iC(2<<17); int T; cin>>T; while(T--) { int N,M; cin>>N>>M; mint ans=mint(2).pow(N)-1; ans*=C.get(N-1,M-1); cout<