#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
const int INF = 0x3f3f3f3f;
const long long int LINF = 1LL << 56;
long long int n;
long long int ans = 0, val[1000010], sum = 0, mt;
int main() {
  while (cin >> n) {
    ans = 0;
    sum = 0;
    val[1] = n;
    val[2] = (n * (n - 2)) % mod;
    sum = (val[1] + val[2]) % mod;
    mt = n - 1;
    for (int i = (int)3; i < (int)n + 1; i++) {
      val[i] = ((val[i - 1] * mt) % mod - sum + mod) % mod;
      sum = (sum + val[i]) % mod;
      mt--;
    }
    for (int i = (int)1; i < (int)n + 1; i++) {
      ans = (ans + val[i] * i) % mod;
    }
    cout << ans << '\n';
  }
  return 0;
}
