#include <bits/stdc++.h>
using namespace std;
inline void read(int &x) {
  char ch;
  bool flag = false;
  for (ch = getchar(); !isdigit(ch); ch = getchar())
    if (ch == '-') flag = true;
  for (x = 0; isdigit(ch); x = x * 10 + ch - '0', ch = getchar())
    ;
  x = flag ? -x : x;
}
const int INF = 0x3f3f3f3f;
const long long mod = 998244353;
long long s[1000006];
int main() {
  long long n;
  cin >> n;
  s[1] = 1;
  s[2] = 2;
  s[3] = 9;
  long long j = 6;
  for (int i = 4; i <= n; i++) {
    s[i] = ((s[i - 1] - 1) * i * 1ll) % mod;
    j = (j * i * 1ll) % mod;
    s[i] = (s[i] + j) % mod;
  }
  cout << s[n] << endl;
  return 0;
}
