#include #include #include #include #include using namespace std; using ll = long long; #include using mint = atcoder::modint998244353; const int mx = 2e6 + 10; mint fac[mx],ifac[mx]; mint comb(int n,int r){ return fac[n] * ifac[r] * ifac[n-r]; } int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); ll n,m; cin>>n>>m; fac[0] = 1; for(int i = 1;i> use; if(m==0){ for(int i = 1;i<=n;i++) { use.push_back(make_pair(0,i)); use.push_back(make_pair(0,-i)); use.push_back(make_pair(i,0)); use.push_back(make_pair(-i,0)); } use.push_back(make_pair(0,0)); } for(ll i = 1;i*i<=m;i++){ if(m%i!=0) continue; ll a = i; ll b = m / i; use.push_back(make_pair(a,b)); use.push_back(make_pair(-a,-b)); swap(a,b); use.push_back(make_pair(a,b)); use.push_back(make_pair(-a,-b)); } sort(use.begin(),use.end()); use.erase(unique(use.begin(),use.end()),use.end()); for(int i = 0;in||y>n) continue; ans += comb(n,x) * comb(n,y); } ans /= mint(4).pow(n); cout<