#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
struct less_key {
  bool operator()(pair<pair<long long int, long long int>, long long int> p1,
                  pair<pair<long long int, long long int>, long long int> p2) {
    return p1.second > p2.second;
  }
};
const long long int mod = 1000000007ll;
const long long int mod2 = 998244353ll;
const long long int inf = 10000000000000007ll;
const double eps = 1e-10;
template <typename T = long long int, T D = 0>
class MaxOp {
 public:
  static T op(const T& a, const T& b) { return max(a, b); }
  static T def() { return (T)D; }
};
template <typename T = long long int, T D = inf>
class MinOp {
 public:
  static T op(const T& a, const T& b) { return min(a, b); }
  static T def() { return (T)D; }
};
template <typename T = long long int, T D = 0>
class SumOp {
 public:
  static T op(const T& a, const T& b) { return a + b; }
  static T def() { return (T)D; }
};
template <typename D, typename T = long long int>
class SegTree {
 public:
  long long int n;
  vector<T> t;

 private:
  void build(const long long int* a, int v, int tl, int tr) {
    if (tl == tr)
      t[v] = a[tl];
    else {
      int tm = (tl + tr) / 2;
      build(a, v * 2, tl, tm);
      build(a, v * 2 + 1, tm + 1, tr);
      t[v] = D().op(t[v * 2], t[v * 2 + 1]);
    }
  }
  long long int get(int v, int tl, int tr, int l, int r) {
    if (l > r) {
      return D().def();
    }
    if (l == tl && r == tr) {
      return t[v];
    }
    int tm = (tl + tr) / 2;
    return D().op(get(v * 2, tl, tm, l, min(r, tm)),
                  get(v * 2 + 1, tm + 1, tr, max(l, tm + 1), r));
  }
  void update(int v, int tl, int tr, int pos, int new_val) {
    if (tl == tr) {
      t[v] = new_val;
    } else {
      int tm = (tl + tr) / 2;
      if (pos <= tm) {
        update(v * 2, tl, tm, pos, new_val);
      } else {
        update(v * 2 + 1, tm + 1, tr, pos, new_val);
      }
      t[v] = D().op(t[v * 2] + t[v * 2 + 1]);
    }
  }

 public:
  void build(const vector<long long int>& a) {
    n = a.size();
    t.resize(n * 4);
    build(a.data(), 1, 0, n - 1);
  }
  void build(long long int* a, long long int n) {
    this->n = n;
    t.resize(n * 4);
    build(a, 1, 0, n - 1);
  }
  long long int get(long long int l, long long int r) {
    return get(1, 0, n - 1, l, r);
  }
  void update(long long int pos, long long int new_val) {
    update(1, 0, n - 1, pos, new_val);
  }
};
long long int n;
const long long int smod = 998244353;
const long long int MAXN = 1000006;
long long int c[MAXN];
long long int dp[MAXN];
inline long long int ssmod(long long int i) {
  if (i < 0) {
    return (i + smod) % smod;
  } else {
    return i % smod;
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout.precision(15);
  cout.setf(ios::fixed);
  long long int n;
  cin >> n;
  c[1] = 1;
  for (long long int i = 2; i <= n; i++) {
    c[i] = c[i - 1] * i;
    c[i] %= smod;
  }
  for (long long int i = 3; i <= n; i++) {
    dp[i] = i * ssmod(c[i - 1] - 1 + dp[i - 1]);
    dp[i] %= smod;
  }
  cout << (c[n] + dp[n]) % smod;
  return 0;
}
