#include <bits/stdc++.h>
using namespace std;
int N;
int main() {
  cin >> N;
  long long int A[N + 1];
  A[1] = 1;
  long long int currentFact = 1;
  for (int i = 2; i <= N; i++) {
    currentFact *= i;
    currentFact %= 998244353;
    A[i] = ((A[i - 1] * i) % 998244353 - i + currentFact) % 998244353;
  }
  printf("%lld\n", A[N]);
}
