#include using namespace std; using ll = long long; template istream& operator >> (istream& is, vector& vec) { for(T& x : vec) is >> x; return is; } template ostream& operator << (ostream& os, const vector& vec) { if(vec.empty()) return os; os << vec[0]; for(auto it = vec.begin(); ++it != vec.end(); ) os << ' ' << *it; return os; } template struct prime_modint { using mint = prime_modint; unsigned int v; prime_modint() : v(0) {} prime_modint(unsigned int a) { a %= MOD; v = a; } prime_modint(unsigned long long a) { a %= MOD; v = a; } prime_modint(int a) { a %= (int)(MOD); if(a < 0)a += MOD; v = a; } prime_modint(long long a) { a %= (int)(MOD); if(a < 0)a += MOD; v = a; } static constexpr int mod() { return MOD; } mint& operator++() {v++; if(v == MOD)v = 0; return *this;} mint& operator--() {if(v == 0)v = MOD; v--; return *this;} mint operator++(int) { mint result = *this; ++*this; return result; } mint operator--(int) { mint result = *this; --*this; return result; } mint& operator+=(const mint& rhs) { v += rhs.v; if(v >= MOD) v -= MOD; return *this; } mint& operator-=(const mint& rhs) { if(v < rhs.v) v += MOD; v -= rhs.v; return *this; } mint& operator*=(const mint& rhs) { v = (unsigned int)((unsigned long long)(v) * rhs.v % MOD); return *this; } mint& operator/=(const mint& rhs) { return *this = *this * rhs.inv(); } mint operator+() const { return *this; } mint operator-() const { return mint() - *this; } mint pow(long long n) const { assert(0 <= n); mint r = 1, x = *this; while (n) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; } mint inv() const { assert(v); return pow(MOD - 2); } friend mint operator+(const mint& lhs, const mint& rhs) { return mint(lhs) += rhs; } friend mint operator-(const mint& lhs, const mint& rhs) { return mint(lhs) -= rhs; } friend mint operator*(const mint& lhs, const mint& rhs) { return mint(lhs) *= rhs; } friend mint operator/(const mint& lhs, const mint& rhs) { return mint(lhs) /= rhs; } friend bool operator==(const mint& lhs, const mint& rhs) { return (lhs.v == rhs.v); } friend bool operator!=(const mint& lhs, const mint& rhs) { return (lhs.v != rhs.v); } friend std::ostream& operator << (std::ostream &os, const mint& rhs) noexcept { return os << rhs.v; } }; //using mint = prime_modint<1000000007>; using mint = prime_modint<998244353>; //enumeration enu(200000);のように宣言する template struct enumeration{ int N; vector fact, inv; enumeration() : N(0), fact(1, 1), inv(1, 1) {} enumeration(int _n) : N(_n), fact(_n + 1), inv(_n + 1) { fact[0] = 1; for(int i = 1; i <= N; i++) fact[i] = fact[i - 1] * i; inv[N] = T(1) / fact[N]; for(int i = N; i >= 1; i--) inv[i - 1] = inv[i] * i; } void expand(int lim){ fact.resize(lim + 1); inv.resize(lim + 1); for(int i = N + 1; i <= lim; i++) fact[i] = i * fact[i - 1]; inv[lim] = T(1) / fact[lim]; for(int i = lim; i >= N + 2; i--) inv[i - 1] = i * inv[i]; N = lim; } T Per(int n, int k){ if(k > n) return 0; if(n > N) expand(n); return fact[n] * inv[n - k]; } T C(int n, int k){ if(n < 0 || k < 0 || k > n) return 0; if(n > N) expand(n); return fact[n] * inv[n - k] * inv[k]; } T H(int n, int k){ if(n ==0 && k == 0) return 1; if(n <= 0 || k < 0) return 0; return C(n + k - 1, k); } }; int main(){ ios::sync_with_stdio(false); cin.tie(0); ll n, m; cin >> n >> m; m = abs(m); enumeration enu(2 * n); mint ans; if(m == 0){ if(n % 2 == 1) cout << 0 << '\n'; else cout << enu.C(n, n / 2) * enu.C(n, n / 2) * mint(mint(1) / 4).pow(n) << '\n'; return 0; } for(ll i = 1; i * i <= m; i++){ if(m % i == 0){ // i = x - (n - x) // i = 2 * x - n // x = (i + n) / 2 if((i + n) % 2 == 1) continue; if((m / i + n) % 2 == 1) continue; ans += (2 + 2 * (i != m / i)) * enu.C(n, (n + i) / 2) * enu.C(n, (n + m / i) / 2); } } ans *= mint(mint(1) / 4).pow(n); cout << ans << '\n'; }