#include <bits/stdc++.h>
using namespace std;
const long long MOD = 998244353;
long long memo[1000006];
long long fakto[1000006];
void pre() {
  memo[1] = 0LL;
  fakto[1] = 1LL;
  for (long long i = 2; i <= 1000000; i++) {
    memo[i] = (i) * (memo[i - 1]) + (i - 1) * (i - 1);
    memo[i] %= MOD;
    fakto[i] = fakto[i - 1] * i;
    fakto[i] %= MOD;
  }
}
long long n;
int main() {
  pre();
  scanf("%lld", &n);
  printf("%lld\n", (((fakto[n] * n - n + 1) % MOD) - memo[n] + MOD) % MOD);
  return 0;
}
