#include <bits/stdc++.h>
using namespace std;
long long fac[1000000];
long long cfac(long long n) {
  if (fac[n] == 0) fac[n] = cfac(n - 1) * n % 998244353;
  return fac[n];
}
int main() {
  fac[0] = 1;
  fac[1] = 1;
  long long n, r = 0;
  cin >> n;
  for (long long i = 2; i < n; i++) {
    r = (i + 1) * (cfac(i) - 1 + r);
    r %= 998244353;
  }
  r += cfac(n);
  r %= 998244353;
  cout << r;
  return 0;
}
