#include using namespace std; typedef signed long long ll; #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x<(to);x++) #define FORR(x,arr) for(auto& x:arr) #define FORR2(x,y,arr) for(auto& [x,y]:arr) #define ALL(a) (a.begin()),(a.end()) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) template bool chmax(T &a, const T &b) { if(a bool chmin(T &a, const T &b) { if(a>b){a=b;return 1;}return 0;} //------------------------------------------------------- int T,N,M; const ll mo=998244353; const int prime_max = 10101010; vector prime; int NP,divp[prime_max]; vector L,R; void cprime() { if(NP) return; for(int i=2;i=i&&jmo2) r.v[x][y] -= mo2; } FOR(x,n) FOR(y,n) r.v[x][y]%=mo; return r; } Mat powmat(ll p,Mat a,int n=MAT) { int i,x,y; Mat r; FOR(x,n) FOR(y,n) r.v[x][y]=0; FOR(i,n) r.v[i][i]=1; while(p) { if(p%2) r=mulmat(r,a,n); a=mulmat(a,a,n); p>>=1; } return r; } void solve() { int i,j,k,l,r,x,y; string s; cprime(); FORR(p,prime) if(p>3) { if(divp[p^2]==0) { if(p>(p^2)) R.push_back(p); else L.push_back(p); } } cin>>T; while(T--) { cin>>N>>M; if(N==1) { x=lower_bound(ALL(prime),M+1)-prime.begin(); cout<