#include using namespace std; template class static_modint { using mint = static_modint; uint32_t _v = 0; static constexpr bool prime = []() -> bool { if (m == 1) return 0; if (m == 2 || m == 7 || m == 61) return 1; if (m % 2 == 0) return 0; uint32_t d = m - 1; while (d % 2 == 0) d /= 2; for (uint32_t a : {2, 7, 61}) { uint32_t t = d; mint y = mint(a).pow(t); while (t != m - 1 && y != 1 && y != m - 1) { y *= y; t <<= 1; } if (y != m - 1 && t % 2 == 0) return 0; } return 1; }(); static constexpr pair inv_gcd(int32_t a, int32_t b) { if (a == 0) return {b, 0}; int32_t s = b, t = a, m0 = 0, m1 = 1; while (t) { const int32_t u = s / t; s -= t * u; m0 -= m1 * u; swap(s, t); swap(m0, m1); } if (m0 < 0) m0 += b / s; return {s, m0}; } public: static constexpr mint raw(uint32_t v) { mint a; a._v = v; return a; } constexpr static_modint() {} template constexpr static_modint(T v) { static_assert(is_integral_v, "T is not integral type."); if constexpr (is_signed_v) { int64_t x = int64_t(v % int64_t(m)); if (x < 0) x += m; _v = uint32_t(x); } else _v = uint32_t(v % m); } static constexpr uint32_t mod() { return m; } constexpr uint32_t val() const { return _v; } constexpr mint& operator++() { return *this += 1; } constexpr mint& operator--() { return *this -= 1; } constexpr mint operator++(int) { mint res = *this; ++*this; return res; } constexpr mint operator--(int) { mint res = *this; --*this; return res; } constexpr mint& operator+=(mint rhs) { if (_v >= m - rhs._v) _v -= m; _v += rhs._v; return *this; } constexpr mint& operator-=(mint rhs) { if (_v < rhs._v) _v += m; _v -= rhs._v; return *this; } constexpr mint& operator*=(mint rhs) { return *this = *this * rhs; } constexpr mint& operator/=(mint rhs) { return *this *= rhs.inv(); } constexpr mint operator+() const { return *this; } constexpr mint operator-() const { return mint{} - *this; } constexpr mint pow(long long n) const { assert(0 <= n); if(n == 0) return 1; mint x = *this, r = 1; while (1) { if (n & 1) r *= x; n >>= 1; if (n == 0) return r; x *= x; } } constexpr mint inv() const { if constexpr (prime) { assert(_v); return pow(m - 2); } else { auto eg = inv_gcd(_v, m); assert(eg.first == 1); return eg.second; } } friend constexpr mint operator+(mint lhs, mint rhs) { return lhs += rhs; } friend constexpr mint operator-(mint lhs, mint rhs) { return lhs -= rhs; } friend constexpr mint operator*(mint lhs, mint rhs) { return uint64_t(lhs._v) * rhs._v; } friend constexpr mint operator/(mint lhs, mint rhs) { return lhs /= rhs; } friend constexpr bool operator==(mint lhs, mint rhs) { return lhs._v == rhs._v; } friend constexpr bool operator!=(mint lhs, mint rhs) { return lhs._v != rhs._v; } }; using mint = static_modint<998244353>; istream& operator>>(istream& in, mint& x) { long long a; in >> a; x = a; return in; } ostream& operator<<(ostream& out, mint x) { return out << x.val(); } constexpr mint operator""_M(unsigned long long x) { return x; } constexpr uint32_t fact_mx = min(1e6, mint::mod() - 1); mint fac[fact_mx + 1], inv[fact_mx + 1]; struct factorial { factorial() { fac[0] = 1; for(uint32_t i = 1; i <= fact_mx; i++) fac[i] = fac[i - 1] * mint::raw(i); inv[fact_mx] = fac[fact_mx].inv(); for(uint32_t i = fact_mx; i; i--) inv[i - 1] = inv[i] * mint::raw(i); } } factorial; mint inverse(long long n) { return inv[n] * fac[n - 1]; } mint perm(long long n, long long r) { if(n < r || r < 0) return 0; if(n > fact_mx) [[unlikely]] { mint ans = 1, x = n; while(r--) ans *= x--; return ans; } return fac[n] * inv[n - r]; } mint comb(long long n, long long r) { if(n < r || r < 0) return 0; r = min(r, n - r); const mint ans = perm(n, r); return ans * inv[r]; } template mint comb(long long n, T... rs) { if(n < 0) return 0; mint ans = fac[n]; long long rn = n; for(long long r : {rs...}) { if(r < 0) return 0; ans *= inv[r]; rn -= r; } if(rn < 0) return 0; return ans * inv[rn]; } mint Mcomb(long long n, long long r){ return comb(n + r - 1, r); } // r balls into n boxes /* k 回振ったときの総和の確率密度分布 f_k(x) = f_1(x) の k 回畳み込み 区分 k - 1 次関数 区分の長さはそれぞれ 1 モーメント母関数ってやつを考えれば良いですか M(f_1) = (e^t - 1) / t p[k][x] := k 回振ったときに総和が x 以下になる確率 のテーブルを求めてみよう https://oeis.org/A008292 https://en.wikipedia.org/wiki/Eulerian_number あったあ https://en.wikipedia.org/wiki/Eulerian_number を T(n,k) として sum(T(n,k)/n! for n ≥ 0, 0 ≤ k < N) が答え sum(T(n,0)/n! for n ≥ 0) = e sum(T(n,1)/n! for n ≥ 0) = -2 e + e^2 sum(T(n,2)/n! for n ≥ 0) * 2! = 3 e -6 e^2 +2 e^3 sum(T(n,3)/n! for n ≥ 0) * 3! = -4 e +24 e^2 -24 e^3 +6 e^4 sum(T(n,4)/n! for n ≥ 0) * 4! = 5 e -80 e^2 +180 e^3 -120 e^4 +24 e^5 縦に見て OEIS に入れたりすると、sum(T(i,n)/i! for i ≥ 0) の e^k の係数は k^{n + 1 - k} / (n + 1 - k)! * (n + 1) / k * (-1)^{n+k+1} とりあえず 2 乗 */ int main() { int N; cin >> N; vector ans(N + 1); for(int k = 1; k <= N; k++) { const mint K = k; mint powK = K.inv(); for(int n = k; n <= N; n++) { const mint x = powK * inv[n - k] * n; if((n + k) % 2) ans[k] -= x; else ans[k] += x; powK *= K; } } for(mint x : ans) cout << x << '\n'; }