#include <bits/stdc++.h>
inline bool VISED(int &x) {
  bool t(x);
  x = 1;
  return t;
}
using namespace std;
const long long llinf = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
const int maxn = int(1e6 + 10);
const int mod(998244353);
int n;
long long jie[maxn] = {1};
long long solve(int n) {
  long long ans(jie[n] * n % mod);
  ans = ans;
  long long p(n), res(n);
  for (long long len1 = n - 1; len1 >= 2; --len1) {
    res = res * len1 % mod;
    p = (p + res) % mod;
  }
  ans = ans - p;
  ans %= mod;
  if (ans < 0) ans += mod;
  return ans;
}
int main() {
  int T(1), times(0);
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  while (++times, T--) {
    cin >> n;
    if (n == 1) {
      cout << 1 << endl;
      continue;
    }
    for (int i = 1; i <= n + 2; i++) jie[i] = jie[i - 1] * i % mod;
    cout << solve(n) << endl;
  }
  return 0;
}
