#include <bits/stdc++.h>
using namespace std;
long long ma, mi, ans, res, n, m, k, temp1, temp2, temp, t, ok, f[1000009],
    dp[1000009];
vector<long long> v, vans;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  f[0] = 1;
  for (long long i = 1; i <= 1000000; i++) {
    f[i] = (f[i - 1] * i) % 998244353;
  }
  dp[1] = 1;
  for (long long i = 2; i <= 1000000; i++) {
    dp[i] = ((dp[i - 1] - 1) * i + f[i]) % 998244353;
  }
  cout << dp[n];
}
