#include <bits/stdc++.h>
using namespace std;
const long long int inf = 9e18;
const long double pi = 2 * acos(0.0);
long long int fac[1000005], dp[1000005];
void solve() {
  long long int n;
  cin >> n;
  cout << dp[n] << "\n";
  return;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int tc = 1;
  fac[0] = 1;
  for (long long int i = 1; i < 1000005; ++i)
    fac[i] = (fac[i - 1] * i) % 998244353;
  dp[1] = 1;
  for (long long int i = 2; i < 1000005; ++i)
    dp[i] = (((((dp[i - 1] + fac[i - 1]) % 998244353 - 1 + 998244353)) %
              998244353) *
             i) %
            998244353;
  while (tc--) {
    solve();
  }
}
