#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using pii = pair<int, int>;
using vii = vector<pii>;
using ll = long long;
int solve();
int main(int argc, char* argv[]) {
  ::std::ios::sync_with_stdio(false);
  ::std::cin.tie(0);
  ::std::cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
}
int solve() {
  constexpr int P = 998244353;
  ll n, x, a;
  cin >> n;
  x = n;
  a = 0;
  for (ll i = 0; i < n - 1; ++i) {
    a += ((x * (n - i - 1)) % P) * (i + 1) + (P - x);
    a %= P;
    x = (x * (n - i)) % P;
  }
  ll ans = x * (x - n + 2) - 2 * a + P;
  ans %= P;
  if (ans % 2 == 1)
    ans = (ans + P) / 2;
  else
    ans /= 2;
  cout << ans << endl;
  return 0;
}
