#include <bits/stdc++.h>
using namespace std;
const long long INFLL = 2 * (long long)1e18 + 100;
const long long INFINT = 2 * (long long)1e9 + 100;
const double PI = atan(1) * 4;
const double EPS = 1e-6;
const long long SEED = (long long)1e3 + 7;
const long long MOD = 998244353;
const long long NMAX = (long long)1e5 + 5;
vector<long long> v;
long long sum[NMAX];
long long solve(long long n) {
  vector<long long> temp;
  for (long long i = 1; i <= n; i++) temp.push_back(i);
  do {
    for (auto i : temp) v.push_back(i);
  } while (next_permutation(temp.begin(), temp.end()));
  long long sol = 0;
  for (long long i = 1; i <= v.size(); i++) {
    sum[i] = sum[i - 1] + v[i - 1];
    if (i >= n) {
      long long here = sum[i] - sum[i - n];
      if (here == n * (n + 1) / 2) sol++;
    }
  }
  return sol;
}
long long fact(long long x) {
  if (x == 1) return 1;
  return x * fact(x - 1) % MOD;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  long long sol = n * fact(n) % MOD;
  long long prev = 1;
  for (long long i = n; i >= 2; i--) {
    prev = prev * i % MOD;
    sol = sol - prev;
    if (sol < 0) sol += MOD;
  }
  cout << sol;
  return 0;
}
