/*
* _|_|_|_|_| _|_|_|_| _|_|_| _|_|_|_|_| _|_|_| _|_|
* _| _| _| _| _| _| _|
* _| _|_|_| _|_| _| _|_| _|
* _| _| _| _| _| _|
* _|_|_|_|_| _| _|_|_| _| _|_|_| _|_|_|_|
*/
#include <bits/stdc++.h>
constexpr int pMod = 998244353;
template<class Tp>
Tp Add(Tp x) {
return x;
}
template<class Tp>
Tp Mul(Tp x) {
return x;
}
template<class Tp, class... Tps>
int Add(Tp x, Tps... y) {
return (x + Add(y...)) % pMod;
}
template<class Tp, class... Tps>
int Mul(Tp x, Tps... y) {
return int(1LL * x * Mul(y...) % pMod);
}
template<class Tp, class... Tps>
void AddC(Tp &x, Tps... y) {
x = Add(x, y...);
}
template<class Tp, class... Tps>
void MulC(Tp &x, Tps... y) {
x = Mul(x, y...);
}
int ExGcd(int a, int b, int &x, int &y) {
if (b == 0) return x = 1, y = 0, a;
int d = ExGcd(b, a % b, y, x);
return y -= a / b * x, d;
}
int Inv(int x) {
int ret, t, d = ExGcd(x, pMod, ret, t);
return d * Add(ret, pMod);
}
std::vector<int> fac, invFac;
void InitFac() {
fac.resize(n + 1);
invFac.resize(n + 1);
fac[0] = 1;
for (int i = 1; i <= n; i++) fac[i] = Mul(fac[i - 1], i);
invFac[n] = Inv(fac[n]);
for (int i = n; i >= 1; i--) invFac[i - 1] = Mul(invFac[i], i);
}
namespace Solution {
int Solve(int N) {
if (N == 3) {
return 1;
}
InitFac(N);
int ans = 0;
std::vector<std::vector<int>> dp(N, std::vector<int>(N));
dp[1][1] = 1;
for (int i = 1; i + 2 < N; i++) {
for (int j = 1; j <= i; j++) {
for (int k = 1; k <= 3; k++) {
if (i + k + 2 < N) {
AddC(dp[i + k][j + 1], dp[i][j]);
}
}
}
}
for (int l = 0; l < 3; l++) {
int p = N - 3 - l;
if (p <= 0) {
continue;
}
for (int j = 1; j <= p; j++) {
int v = Mul(dp[p][j], fac[j]);
MulC(v, invFac[N], fac[N - j - 1]);
AddC(ans, Mul(v, 3 - l, j + 1));
}
}
return Mul(ans, N);
}
}
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int N;
std::cin >> N;
std::cout << Solution::Solve(N) << '\n';
return 0;
}