bool TEST = false; using namespace std; #include #include #define rep(i,n) for(ll (i)=0;(i)<(ll)(n);i++) #define rrep(i,n) for(ll (i)=(ll)(n)-1;(i)>=0;i--) #define range(i,start,end,step) for(ll (i)=start;(i)<(ll)(end);(i)+=(step)) #define rrange(i,start,end,step) for(ll (i)=start;(i)>(ll)(end);(i)+=(step)) #define dump(x) cerr << "Line " << __LINE__ << ": " << #x << " = " << (x) << "\n"; #define spa << " " << #define fi first #define se second #define all(a) (a).begin(),(a).end() #define allr(a) (a).rbegin(),(a).rend() template T SUM(vector &A) { T sum = T(0); for (auto &&a: A) sum += a; return sum; } #define MIN(v) *min_element(all(v)) #define MAX(v) *max_element(all(v)) using ld = long double; using ll = long long; using ull = unsigned long long; using pii = pair; using pll = pair; using pdd = pair; template using V = vector; template using VV = V>; template using P = pair; template using UM = unordered_map; template using PQ = priority_queue, greater>; template using rPQ = priority_queue, less>; templatevector make_vec(size_t a){return vector(a);} templateauto make_vec(size_t a, Ts... ts){return vector(ts...))>(a, make_vec(ts...));} template ostream& operator << (ostream& os, const pair v){os << "(" << v.first << ", " << v.second << ")"; return os;} template ostream& operator<<(ostream &os, const vector &v) { for (auto &e : v) os << e << ' '; return os; } template ostream& operator<<(ostream& os, const vector> &v){ for(auto &e : v){os << e << "\n";} return os;} struct fast_ios { fast_ios(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_; template void UNIQUE(vector &x) {sort(all(x));x.erase(unique(all(x)), x.end());} 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; } void fail() { cout << -1 << '\n'; exit(0); } inline int popcount(const int x) { return __builtin_popcount(x); } inline int popcount(const ll x) { return __builtin_popcountll(x); } template void debug(vector>&v){for(ll i=0;i void debug(vector&v){if(v.size()!=0)cerr< void debug(priority_queue&v){V vals; while(!v.empty()) {cerr << v.top() << " "; vals.push_back(v.top()); v.pop();} cerr<<"\n"; for(auto val: vals) v.push(val);} template void debug(map&v){for(auto [k,v]: v) cerr << k spa v << "\n"; cerr<<"\n";} template void debug(unordered_map&v){for(auto [k,v]: v) cerr << k spa v << "\n";cerr<<"\n";} V listrange(int n) {V res(n); rep(i,n) res[i]=i; return res;} string YES = "Yes"; string NO = "No"; void pans(bool v){if (v) cout << YES << "\n"; else cout << NO << "\n";} template P divmod(T a, T b) {return make_pair(a/b, a%b);} const ll INF = (1ll<<62); // const ld EPS = 1e-10; // const ld PI = acos(-1.0); template< int mod > struct ModInt { int x; ModInt() : x(0) {} ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {} ModInt &operator+=(const ModInt &p) { if((x += p.x) >= mod) x -= mod; return *this; } ModInt &operator-=(const ModInt &p) { if((x += mod - p.x) >= mod) x -= mod; return *this; } ModInt &operator*=(const ModInt &p) { x = (int) (1LL * x * p.x % mod); return *this; } ModInt &operator/=(const ModInt &p) { *this *= p.inverse(); return *this; } ModInt operator-() const { return ModInt(-x); } ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; } ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; } ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; } ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; } bool operator==(const ModInt &p) const { return x == p.x; } bool operator!=(const ModInt &p) const { return x != p.x; } ModInt inverse() const { int a = x, b = mod, u = 1, v = 0, t; while(b > 0) { t = a / b; swap(a -= t * b, b); swap(u -= t * v, v); } return ModInt(u); } ModInt pow(int64_t n) const { ModInt ret(1), mul(x); while(n > 0) { if(n & 1) ret *= mul; mul *= mul; n >>= 1; } return ret; } friend ostream &operator<<(ostream &os, const ModInt &p) { return os << p.x; } friend istream &operator>>(istream &is, ModInt &a) { int64_t t; is >> t; a = ModInt< mod >(t); return (is); } static int get_mod() { return mod; } }; using m17 = ModInt<1'000'000'007>; using m98 = ModInt<998'244'353>; using MOD = m98; ll mod = 998'244'353; // using MOD = m17; // ll mod = 1'000'000'007; V g1; V g2; V inverse; void prepare(int n) { chmax(n,10); int s = max(2, (int)g1.size()); g1.resize(n+1); g2.resize(n+1); inverse.resize(n+1); g1[0] = g1[1] = g2[0] = g2[1] = 1; inverse[0] = 0; inverse[1] = 1; range(i,s,n+1,1) { g1[i] = g1[i-1]*i; inverse[i] = -inverse[mod%i]*(mod/i); g2[i] = g2[i-1]*inverse[i]; } } template MOD cmb(T n, T r) { if (r<0 || r>n) return 0; if (g1.size()<=n) prepare(n); r = min(r, n-r); return g1[n]*g2[r]*g2[n-r]; } template MOD perm(T n, T r) { if (r<0 || r>n) return 0; if (g1.size()<=n) prepare(n); return g1[n]*g2[n-r]; } void Main(){ ll n,m; cin >> n >> m; if (m<0) m *= -1; V a(n); MOD ans = 0; auto sub = [&](ll a) { if ((n+a)&1) return (MOD)0; ll p = (n+a)/2; return cmb((ll)n,(ll)p); }; if (m==0) { // cout << sub(0) << endl; MOD prob = sub(0) / MOD(2).pow(n); ans = MOD(1) - (MOD(1) - prob) * (MOD(1) - prob); } else { range(a, 1, m+1, 1) { if (a*a>m) break; if (m%a!=0) continue; ll b = m/a; MOD val = sub(a) * sub(b); if (a!=b) val *= 2; ans += val; } ans *= 2; ans /= MOD(4).pow(n); } cout << ans << "\n"; } int main(void){ std::ifstream in("tmp_in"); if (TEST) { std::cin.rdbuf(in.rdbuf()); std::cout << std::fixed << std::setprecision(15); } else { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(15); } Main(); }