#include <bits/stdc++.h>
using namespace std;
int n, ans;
const int mod = 998244353;
int main() {
  scanf("%d", &n);
  for (int i = ans = 1; i <= n; i++) ans = 1ll * ans * i % mod;
  int cnt = n;
  for (int k = 1; k < n - 1; k++) {
    ans = (ans + 1ll * k * cnt % mod * (n - k - 1)) % mod;
    cnt = 1ll * cnt * (n - k) % mod;
  }
  printf("%d\n", ans);
}
