#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 5;
const int MOD = 998244353;
int N, M, K, Q, T;
int fact[MAXN];
int dp[MAXN];
int main() {
  int i, j;
  scanf("%d", &N);
  fact[0] = 1;
  for (i = 1; i <= N; ++i) {
    fact[i] = fact[i - 1] * 1ll * i % MOD;
  }
  dp[1] = dp[2] = 0;
  for (i = 3; i <= N; ++i) {
    dp[i] =
        ((((fact[i - 1] - 1 + MOD) % MOD) + dp[i - 1]) % MOD) * 1ll * i % MOD;
  }
  int sum = (fact[N] + dp[N]) % MOD;
  printf("%d", sum);
  return 0;
}
