mod=998244353 M=(10**5)*3+1 fac=[1]*M ninv=[1]*M finv=[1]*M for i in range(2,M): fac[i]=fac[i-1]*i%mod ninv[i]=(-(mod//i)*ninv[mod%i])%mod finv[i]=finv[i-1]*ninv[i]%mod def binom(n,k): if n<0 or k<0: return 0 if k>n: return 0 return (fac[n]*finv[k]%mod)*finv[n-k]%mod from sys import stdin input=lambda :stdin.readline()[:-1] def solve(): n,m=map(int,input().split()) ans=0 for i in range(m): ans+=binom(n-1,i) ans%=mod ans*=pow(2,n)-1 print(ans%mod) for _ in range(int(input())): solve()