#include #include #include #include #include #include #if defined FIO auto FI=freopen("1.in","r",stdin); auto FO=freopen("1.out","w",stdout); #endif #if defined BUG #define bug(x...) ({x;void();}) #else #define bug(x...) ({}) #endif #define LL long long #define pb push_back #define vec vector #define arr array #define SIZ(x) (int)(x).size() #define ALL(x) begin(x),end(x) #define RNG(x,l,r) &(x)[l],1+&(x)[r] #define rep(i,l,r) for(int i=(l),i##_=(r);i<=i##_;i++) #define per(i,l,r) for(int i=(l),i##_=(r);i>=i##_;i--) #define inline inline __attribute__((always_inline)) templateconstexpr inline void tomin(U&x,V&&y)noexcept{if(yconstexpr inline void tomax(U&x,V&&y)noexcept{if(y>x)x=y;} struct FIN{ static constexpr signed S_=1<<20;char B_[S_],*H_,*T_; #define getchar() (H_==T_&&(T_=(H_=B_)+fread(B_,1,S_,stdin),H_==T_)?EOF:*H_++) inline bool isspace(char m){return m==' '||m=='\n'||m=='\r';} inline void fin(char&m)noexcept{do{}while(isspace(m=getchar()));} templateinline void fin(T&x)noexcept{char m=0,f=0;do if(m==45)f=1;while(m=getchar(),m<48||m>57);x=0;do x=x*10+(m^48);while(m=getchar(),m>=48&&m<=57);if(f)x=-x;} templateinline FIN& operator>>(T&x)noexcept{fin(x);return *this;} }; struct FOUT{ inline void fout(char m)noexcept{putchar(m);} inline void fout(const char*s)noexcept{printf("%s",s);} templateinline void fout(T x)noexcept{char d[40],l=-1;if(x<0)x=-x,putchar(45);do d[(signed)++l]=char((x%10)^48);while(x/=10);do putchar(d[(signed)l]);while(~--l);} templateinline FOUT& operator<<(T x)noexcept{fout(x);return *this;} }; using namespace std;namespace __{ // FIN cin; FOUT cout; auto SYNC=cin.tie(0)->sync_with_stdio(0); #define clear() constexpr int N=2e5+5,P=998244353; inline int fpw(int a,int b,int r=1){ for(; b; a = 1LL * a * a % P, b>>=1) if(b&1) r = 1LL * r * a % P; return r;} int fac[N],invfac[N]; inline void init(int n){ fac[0]=1; rep(i,1,n) fac[i] = 1LL * fac[i-1] * i % P; invfac[n] = fpw(fac[n], P-2); per(i,n,1) invfac[i-1] = 1LL * invfac[i] * i % P; } inline int binom(int a,int b){ if(a pw2(2e5+5); pw2[0]=1; rep(i,1,2e5) pw2[i] = pw2[i-1] * 2 % P; signed CSE=0; for(cin>>CSE; CSE--; clear()) [&](){ int n,m; cin>>n>>m; LL sum=0; rep(k,0,m-1) sum+=binom(n-1,k); cout<<(sum%P) * (pw2[n] - 1 + P) % P<<'\n'; }();}} signed main(){__::main();}