#include #include using namespace std; using namespace atcoder; using ll = long long; using P = pair; #define rep(i,n) for(int (i)=0;(i)<(n);(i)++) #define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++) #define rep2ll(i,m,n) for(ll (i)=(m);(i)<(n);(i)++) #define ALL(obj) (obj).begin(), (obj).end() #define rALL(obj) (obj).rbegin(), (obj).rend() const ll INF60 = 1LL<<60;//1152921504606846976 const int INF30 = 1<<30; using mint = modint998244353; using VL = vector; using VVL = vector; using VVVL = vector; using VM = vector; using VVM = vector; using VVVM = vector; using VD = vector; using VVD = vector; using VVVD = vector; templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b struct Combination { vector< T > _fact, _rfact, _inv; Combination(int sz) : _fact(sz + 1), _rfact(sz + 1), _inv(sz + 1) { _fact[0] = _rfact[sz] = _inv[0] = 1; for(int i = 1; i <= sz; i++) _fact[i] = _fact[i - 1] * i; _rfact[sz] /= _fact[sz]; for(int i = sz - 1; i >= 0; i--) _rfact[i] = _rfact[i + 1] * (i + 1); for(int i = 1; i <= sz; i++) _inv[i] = _rfact[i] * _fact[i - 1]; } inline T fact(int k) const { return _fact[k]; } inline T rfact(int k) const { return _rfact[k]; } inline T inv(int k) const { return _inv[k]; } T P(int n, int r) const { if(r < 0 || n < r) return 0; return fact(n) * rfact(n - r); } T C(int p, int q) const { if(q < 0 || p < q) return 0; return fact(p) * rfact(q) * rfact(p - q); } T H(int n, int r) const { if(n < 0 || r < 0) return (0); return r == 0 ? 1 : C(n + r - 1, r); } }; int main(){ ios::sync_with_stdio(false); cin.tie(0); ll n, m; cin>>n>>m; m = abs(m); Combination c(n); mint ans = 0; if(m==0){ if(n%2) ans = 0; else ans = c.C(n,n/2)*mint(2).pow(n+1)-c.C(n,n/2).pow(2); }else{ for(ll x=1; x*x<=m; x++){ if(m%x) continue; ll y = m/x; if((n+x)%2||(n+y)%2) continue; ans += c.C(n,(n+x)/2) * c.C(n,(n+y)/2) * (1+(x!=y)); } ans *= 2; } // cerr<