#include <bits/stdc++.h>
using namespace std;
const long long N = 1000005, M = 998244353;
long long n, fac[N], c[N << 1], inv[N];
long long ksm(long long x, long long y) {
  long long ans = 1;
  for (; y; y >>= 1, x = x * x % M)
    if (y & 1) (ans *= x) %= M;
  return ans;
}
signed main() {
  scanf("%lld", &n);
  fac[0] = 1;
  for (long long i = 1; i <= n; i++)
    fac[i] = fac[i - 1] * i % M, inv[i] = ksm(fac[i], M - 2);
  c[0] = n;
  for (long long i = 1; i < n; i++)
    c[i] = fac[n] * inv[n - i + 1] % M * (((n - i) * (n - i) + 1) % M) % M;
  for (long long i = n; i < 2 * n; i++) c[i] = (fac[n] - c[i - n] + M) % M;
  long long ans = n * fac[n] % M;
  (ans *= (ans + 1) * (M / 2 + 1) % M) %= M;
  for (long long i = 1; i < 2 * n; i++) (ans += M - c[i] * i % M) %= M;
  printf("%lld\n", ans);
}
