#include using namespace std; //* ATCODER #include using namespace atcoder; typedef modint998244353 mint; //*/ /* BOOST MULTIPRECISION #include using namespace boost::multiprecision; //*/ typedef long long ll; #define rep(i, s, n) for (int i = (int)(s); i < (int)(n); i++) #define rrep(i, s, n) for (int i = (int)(n)-1; i >= (int)(s); i--) template bool chmin(T &a, const T &b) { if (a <= b) return false; a = b; return true; } template bool chmax(T &a, const T &b) { if (a >= b) return false; a = b; return true; } template T max(vector &a){ assert(!a.empty()); T ret = a[0]; for (int i=0; i<(int)a.size(); i++) chmax(ret, a[i]); return ret; } template T min(vector &a){ assert(!a.empty()); T ret = a[0]; for (int i=0; i<(int)a.size(); i++) chmin(ret, a[i]); return ret; } template T sum(vector &a){ T ret = 0; for (int i=0; i<(int)a.size(); i++) ret += a[i]; return ret; } // makediv vector makediv(ll n){ vector ld, ud; for (ll i=1; i*i<=n; i++){ if (n%i == 0){ ld.push_back(i); if (i != n/i){ ud.push_back(n/i); } } } reverse(ud.begin(), ud.end()); ld.insert(ld.end(), ud.begin(), ud.end()); return ld; } // ----- //defmodfact const int COMinitMAX = 2222222; mint fact[COMinitMAX+1], factinv[COMinitMAX+1]; void modfact(){ fact[0] = 1; for (int i=1; i<=COMinitMAX; i++){ fact[i] = fact[i-1] * i; } factinv[COMinitMAX] = fact[COMinitMAX].inv(); for (int i=COMinitMAX-1; i>=0; i--){ factinv[i] = factinv[i+1] * (i+1); } } mint cmb(int a, int b){ if (a> n; ll m; cin >> m; mint ans = 0; if (m != 0){ m = abs(m); vector g = makediv(m); for (ll d: g){ if (abs(d + m / d) % 2 != 0 || abs(d - m / d) % 2 != 0) continue; ll x = abs(d + m / d) / 2; ll y = abs(d - m / d) / 2; //cout << d << " " << m / d << '\n'; if (abs(x) + abs(y) > n) continue; for (ll k=0; k<=n; k++){ if ((k+x)%2 == 1) continue; if ((n-k+y)%2 == 1) continue; ans += cmb(k, (k+x)/2) * cmb(n-k, (n-k+y)/2) * cmb(n, k); } } cout << ans.val() << '\n'; ans *= mint(4).inv().pow(n); ans *= 2; }else{ assert(false); } cout << ans.val() << '\n'; }