#include <bits/stdc++.h>
using namespace std;
int mod = 998244353;
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  long long int fac[n + 1];
  fac[0] = 1;
  for (int i = 1; i <= n; i++) {
    fac[i] = fac[i - 1] * i;
    fac[i] %= mod;
  }
  long long int dp[n + 1];
  dp[0] = 1;
  for (int i = 1; i <= n; i++) {
    dp[i] = (dp[i - 1] + fac[i - 1] - 1) * i;
    dp[i] %= mod;
  }
  cout << dp[n] << endl;
  return 0;
}
