#include #include using mint = atcoder::modint998244353; static constexpr int N = 30000; using poly = std::array; using coef = std::array; using hp = std::map; coef add(coef c, int i) { c[i]++; return c; } coef proj(coef c, int i) { c[i] = 0; return c; } int main() { int K; std::cin >> K; std::array fact, ifact; fact[0] = 1; for (int i = 1; i <= N; i++) fact[i] = fact[i - 1] * i; ifact[N] = 1 / fact[N]; for (int i = N; i >= 1; i--) ifact[i - 1] = ifact[i] * i; std::map pd; pd[{0, 0, 0}] = 1; for (int i = 0; i < 3; i++) { for (int j = i + 1; j < 3; j++) { // x_i - x_j for (int k = 0; k < 2; k++) { std::map nx; for (const auto& [c, v] : pd) { nx[add(c, i)] += v; nx[add(c, j)] -= v; } pd = std::move(nx); } } } for (auto it = pd.begin(); it != pd.end();) { if (it->second == mint(0)) it = pd.erase(it); else ++it; } poly ans; std::array dp; for (int col = 0; col + 3 <= N; col++) { for (int i = 1; i < 3; i++) { int st = std::min(col * i, N + 1); int w = std::min(i, N + 1 - st); for (auto& [c, v] : dp[i]) { std::copy_backward(v.begin() + st, v.end() - w, v.end()); std::fill(v.begin() + st, v.begin() + st + w, mint(0)); } } { int h = (col + 1) * 3; if (h < N + 1) { std::array pow; pow[0] = 1; for (int i = 1; i < 7; i++) pow[i] = pow[i - 1] * (col + 1); mint a = ifact[col + 1] * ifact[col + 1]; std::array pc; for (int j = 0; j < 7; j++) pc[j] = a * pow[j]; for (const auto& [c, v] : pd) { dp[2][proj(c, 2)][h] += pc[c[2]] * v; } } } poly temp; for (int i = 1; i >= 0; i--) { int h = (col + 1) * (i + 1); if (h >= N + 1) continue; std::array pow; pow[0] = 1; for (int t = 1; t < 7; t++) pow[t] = pow[t - 1] * (col + 3 - i); mint a = ifact[col + 3 - i] * ifact[col + 3 - i]; std::array pc; for (int j = 0; j < 7; j++) pc[j] = a * pow[j]; for (const auto& [c, v] : dp[i + 1]) { auto& t = i ? dp[i][proj(c, i)] : temp; mint aa = pc[c[i]]; for (int k = h; k < N + 1; k++) t[k] += aa * v[k]; } } mint a = mint(col + 1).pow(K); for (int k = 0; k < N + 1; k++) { ans[k] += a * temp[k]; } } std::cout << N << "\n"; for (int i = 1; i <= N; i++) { std::cout << (ans[i] * fact[i] * fact[i]).val() << " \n"[i == N]; } return 0; }