#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
long long tmp[1000005];
long long n;
void get_tmp() {
  tmp[1] = -1;
  for (int i = 1; i <= n; i++) tmp[i + 1] = (tmp[i] + 1) * i % mod;
}
long long a[1000005];
int main() {
  cin >> n;
  get_tmp();
  a[1] = 1;
  for (int i = 1; i <= n; i++) a[i + 1] = (a[i] * (i + 1) % mod + tmp[i]) % mod;
  cout << a[n] * n % mod << endl;
}
