#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++) #define chmin(x, y) (x) = min((x), (y)) #define chmax(x, y) (x) = max((x), (y)) #define all(x) (x).begin(),(x).end() #define inf 1e18 using namespace std; typedef long long llint; typedef long long ll; typedef pair P; const ll mod = 998244353; const int FACT_MAX = 200005; llint fact[FACT_MAX], fact_inv[FACT_MAX]; llint modpow(llint a, llint n) { if(n == 0) return 1; if(n % 2){ return ((a%mod) * (modpow(a, n-1)%mod)) % mod; } else{ return modpow((a*a)%mod, n/2) % mod; } } void make_fact() { llint val = 1; fact[0] = 1; for(int i = 1; i < FACT_MAX; i++){ val *= i; val %= mod; fact[i] = val; } fact_inv[FACT_MAX-1] = modpow(fact[FACT_MAX-1], mod-2); for(int i = FACT_MAX-2; i >= 0; i--){ fact_inv[i] = fact_inv[i+1] * (i+1) % mod; } } llint modpow(llint a, llint n, llint mod) { if(n == 0) return 1; if(n % 2){ return ((a%mod) * (modpow(a, n-1, mod)%mod)) % mod; } else{ return modpow((a*a)%mod, n/2, mod) % mod; } } int rev(int x, int n) { int ret = 0; for(int i = 0; i < n; i++){ ret <<= 1; ret |= (x>>i) & 1; } return ret; } //f[]とF[]は異なる実体を持たなければならない。rootには1の原始2^n乗根を渡す void DFT(llint f[], llint F[], int n, llint mod, llint root) { int N = 1<= mod) F[j*l+k] -= mod; if(F[j*l+k+l/2] >= mod) F[j*l+k+l/2] -= mod; x *= z, x %= mod; } } } } //f[]とF[]は異なる実体を持たなければならない。rootには1の原始2^n乗根を渡す void IDFT(llint F[], llint f[], int n, llint mod, llint root) { int N = 1<= mod) f[j*l+k] -= mod; if(f[j*l+k+l/2] >= mod) f[j*l+k+l/2] -= mod; x *= z, x %= mod; } } } llint Ninv = modpow(N, mod-2, mod); for(int i = 0; i < N; i++) f[i] *= Ninv, f[i] %= mod; } ll n; ll a[1<<18], A[1<<18]; ll b[1<<18], B[1<<18]; ll root; int main(void) { ios::sync_with_stdio(0); cin.tie(0); make_fact(); root = modpow(3, 119*32); cin >> n; rep(i, 0, n) a[i] = (i+1) * fact_inv[i] % mod; DFT(a, A, 18, mod, root); b[0] = 1; for(int i = 16; i >= 0; i--){ DFT(b, B, 18, mod, root); rep(j, 0, (1<<18)-1) B[j] *= B[j], B[j] %= mod; IDFT(B, b, 18, mod, root); rep(j, n+1, (1<<18)-1) b[j] = 0; if(n & (1<