#include using namespace std; const int64_t MOD = 998244353; const int64_t ROOT = 3; // MOD-1が何回2で割れるか const int MX_PW = 23; void add(int64_t& a, int64_t b){ a = (a+b) % MOD; } void mul(int64_t& a, int64_t b){ a = a*b % MOD; } int64_t power_mod(int64_t num, int64_t power){ int64_t prod = 1; num %= MOD; while(power > 0){ if(power&1) prod = prod * num % MOD; num = num * num % MOD; power >>= 1; } return prod; } int64_t extgcd(int64_t a, int64_t b, int64_t& x, int64_t& y){ int64_t d = a; if(b != 0){ d = extgcd(b, a%b, y, x); y -= (a/b) * x; }else{ x = 1; y = 0; } return d; } int64_t inv_mod(int64_t a){ int64_t x, y; extgcd(a, MOD, x, y); return (MOD + x%MOD) % MOD; } vector fact, fact_inv; void create_mod_tables(int num){ fact.assign(num+1, 1); fact_inv.assign(num+1, 1); for(int i=1; i<=num; i++) fact[i] = fact[i-1] * i % MOD; fact_inv[num] = inv_mod(fact[num]); for(int i=num; i>0; i--) fact_inv[i-1] = fact_inv[i] * i % MOD; } int64_t comb_mod(int n, int k){ return fact[n] * fact_inv[n-k] % MOD * fact_inv[k] % MOD; } int64_t perm_mod(int n, int k){ return fact[n] * fact_inv[n-k] % MOD; } vector zeta, zeta_inv; void prepare_ntt(){ zeta.resize(MX_PW); zeta_inv.resize(MX_PW); zeta[MX_PW-1] = power_mod(ROOT, (MOD-1)/(1<=0; k--){ zeta[k] = zeta[k+1] * zeta[k+1] % MOD; zeta_inv[k] = zeta_inv[k+1] * zeta_inv[k+1] % MOD; } } void dft(vector& f, int n, bool inverse){ if(n==1) return; int c = 0; for(int i=1; i>1); j>(c^=j); j>>=1); if(c > i){ swap(f[c], f[i]); } } for(int i=1, k=0; i convolution(vector f, vector g, bool truncate=true){ if(zeta.size() == 0) prepare_ntt(); int sz = f.size() + g.size(); int n = 1; while(n <= sz) n <<= 1; f.resize(n); g.resize(n); dft(f, n, false); dft(g, n, false); vector h(n); for(int i=0; i> N >> A >> B; if(A > B) swap(A, B); int64_t x = A, y = B-A, z = N-B; int64_t ans1 = (x*x + y*y + z*z) % MOD * fact[N-1] % MOD; vector V1(x), V2(z); for(int i=0; i