#include <bits/stdc++.h>
using namespace std;
using LL = long long int;
const LL MOD = 998244353;
LL ans[1000005];
LL mod(LL n) { return ((n % MOD) + MOD) % MOD; }
int main() {
  cin.tie(0);
  cin.sync_with_stdio(0);
  ans[1] = 1;
  LL fact = 1;
  for (int i = 2; i <= 1000000; ++i) {
    fact = mod(fact * i);
    ans[i] = mod(mod(mod(ans[i - 1] - 1) * i) + fact);
  }
  int n;
  cin >> n;
  cout << ans[n] << '\n';
}
