#include <bits/stdc++.h>
using namespace std;
long long mod = 998244353;
int main() {
  long long n;
  cin >> n;
  long long cnt = 1, ans = 1;
  for (long long i = 2; i <= n; i++) {
    cnt *= i;
    cnt %= mod;
    ans = cnt + i * (ans - 1);
    ans %= mod;
  }
  cout << ans << endl;
}
