#include #include using namespace std; using ll = long long; #define rep(i,n) for(int i=0;i<(int)(n);i++) using mint = atcoder::modint998244353; const int MOD=998244353; const int MAX_N=2e6; vector fac(MAX_N+1,1); vector finv(MAX_N+1,1); vector inv(MAX_N+1,1); void comb_setup(){ for(int i=2;i<=MAX_N;i++){ fac.at(i)=(fac.at(i-1)*i)%MOD; inv.at(i)=MOD-(inv.at(MOD%i)*(MOD/i))%MOD; finv.at(i)=(finv.at(i-1)*inv.at(i))%MOD; } } ll comb(int n,int k){ if(n> dv(ll n){ vector> rt; for(ll i=1;i*i<=n;i++){ if(n%i==0){ rt.push_back({i,n/i}); } } return rt; } int main(){ comb_setup(); ll n,m; cin>>n>>m; m=abs(m); vector> vp=dv(m); mint ans=0; mint dd=mint(4).inv().pow(n); for(auto[v,u]:vp){ if((v+u)%2) continue; if(u>n) continue; if((n-u)%2) continue; ans+=dd*comb(n,(n-u)/2)*comb(n,(n+v)/2)*(u==v?1:2); } ans*=2; cout<