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