Problem: Let n be an integer. Consider all permutations on integers 1 to n in lexicographic order, and concatenate them into one big sequence P. For example, if n = 3, then P = [1, 2, 3, 1, 3, 2, 2, 1, 3, 2, 3, 1, 3, 1, 2, 3, 2, 1]. The length of this sequence is n ⋅ n!.

Let 1 ≤ i ≤ j ≤ n ⋅ n! be a pair of indices. We call the sequence (P_i, P_{i+1}, ..., P_{j-1}, P_j) a subarray of P. 

You are given n. Find the number of distinct subarrays of P. Since this number may be large, output it modulo 998244353 (a prime number). 

Input

The only line contains one integer n (1 ≤ n ≤ 10^6), as described in the problem statement.

Output

Output a single integer — the number of distinct subarrays, modulo 998244353.

Examples

Input


2


Output


8


Input


10


Output


19210869

Note

In the first example, the sequence P = [1, 2, 2, 1]. It has eight distinct subarrays: [1], [2], [1, 2], [2, 1], [2, 2], [1, 2, 2], [2, 2, 1] and [1, 2, 2, 1]. 

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
template <typename T>
T power(T a, long long b) {
  T r = 1;
  while (b) {
    if (b & 1) {
      r *= a;
    }
    a *= a;
    b >>= 1;
  }
  return r;
}
int inverse(int a, int m) {
  a %= m;
  if (a < 0) {
    a += m;
  }
  int b = m, u = 0, v = 1;
  while (a) {
    int t = b / a;
    b -= a * t;
    swap(a, b);
    u -= v * t;
    swap(u, v);
  }
  if (u < 0) {
    u += m;
  }
  return u;
}
template <int _P>
struct modnum {
  static constexpr int P = _P;

 private:
  int v;

 public:
  modnum() : v(0) {}
  modnum(long long _v) {
    v = _v % P;
    if (v < 0) {
      v += P;
    }
  }
  explicit operator int() const { return v; }
  bool operator==(const modnum& o) const { return v == o.v; }
  bool operator!=(const modnum& o) const { return v != o.v; }
  modnum inverse() const { return modnum(::inverse(v, P)); }
  modnum operator-() const { return modnum(v ? P - v : 0); }
  modnum operator+() const { return *this; }
  modnum& operator++() {
    v++;
    if (v == P) {
      v = 0;
    }
    return *this;
  }
  modnum& operator--() {
    if (v == 0) {
      v = P;
    }
    v--;
    return *this;
  }
  modnum operator++(int) {
    modnum r = *this;
    ++*this;
    return r;
  }
  modnum operator--(int) {
    modnum r = *this;
    --*this;
    return r;
  }
  modnum& operator+=(const modnum& o) {
    v += o.v;
    if (v >= P) {
      v -= P;
    }
    return *this;
  }
  modnum operator+(const modnum& o) const { return modnum(*this) += o; }
  modnum& operator-=(const modnum& o) {
    v -= o.v;
    if (v < 0) {
      v += P;
    }
    return *this;
  }
  modnum operator-(const modnum& o) const { return modnum(*this) -= o; }
  modnum& operator*=(const modnum& o) {
    v = (int)((long long)v * o.v % P);
    return *this;
  }
  modnum operator*(const modnum& o) const { return modnum(*this) *= o; }
  modnum& operator/=(const modnum& o) { return *this *= o.inverse(); }
  modnum operator/(const modnum& o) const { return modnum(*this) /= o; }
};
template <int _P>
ostream& operator<<(ostream& out, const modnum<_P>& n) {
  return out << int(n);
}
template <int _P>
istream& operator>>(istream& in, modnum<_P>& n) {
  long long _v;
  in >> _v;
  n = modnum<_P>(_v);
  return in;
}
using num = modnum<998244353>;
template <typename T>
vector<int> suffix_array(int n, const T& s, int char_bound) {
  vector<int> a(n);
  if (n == 0) {
    return a;
  }
  if (char_bound != -1) {
    vector<int> aux(char_bound, 0);
    for (int i = 0; i < n; i++) {
      aux[s[i]]++;
    }
    int sum = 0;
    for (int i = 0; i < char_bound; i++) {
      int add = aux[i];
      aux[i] = sum;
      sum += add;
    }
    for (int i = 0; i < n; i++) {
      a[aux[s[i]]++] = i;
    }
  } else {
    iota(a.begin(), a.end(), 0);
    sort(a.begin(), a.end(), [&s](int i, int j) { return s[i] < s[j]; });
  }
  vector<int> sorted_by_second(n);
  vector<int> ptr_group(n);
  vector<int> new_group(n);
  vector<int> group(n);
  group[a[0]] = 0;
  for (int i = 1; i < n; i++) {
    group[a[i]] = group[a[i - 1]] + (!(s[a[i]] == s[a[i - 1]]));
  }
  int cnt = group[a[n - 1]] + 1;
  int step = 1;
  while (cnt < n) {
    int at = 0;
    for (int i = n - step; i < n; i++) {
      sorted_by_second[at++] = i;
    }
    for (int i = 0; i < n; i++) {
      if (a[i] - step >= 0) {
        sorted_by_second[at++] = a[i] - step;
      }
    }
    for (int i = n - 1; i >= 0; i--) {
      ptr_group[group[a[i]]] = i;
    }
    for (int i = 0; i < n; i++) {
      int x = sorted_by_second[i];
      a[ptr_group[group[x]]++] = x;
    }
    new_group[a[0]] = 0;
    for (int i = 1; i < n; i++) {
      if (group[a[i]] != group[a[i - 1]]) {
        new_group[a[i]] = new_group[a[i - 1]] + 1;
      } else {
        int pre = (a[i - 1] + step >= n ? -1 : group[a[i - 1] + step]);
        int cur = (a[i] + step >= n ? -1 : group[a[i] + step]);
        new_group[a[i]] = new_group[a[i - 1]] + (pre != cur);
      }
    }
    swap(group, new_group);
    cnt = group[a[n - 1]] + 1;
    step <<= 1;
  }
  return a;
}
template <typename T>
vector<int> suffix_array(const T& s, int char_bound) {
  return suffix_array((int)s.size(), s, char_bound);
}
template <typename T>
vector<int> build_lcp(int n, const T& s, const vector<int>& sa) {
  assert((int)sa.size() == n);
  vector<int> pos(n);
  for (int i = 0; i < n; i++) {
    pos[sa[i]] = i;
  }
  vector<int> lcp(max(n - 1, 0));
  int k = 0;
  for (int i = 0; i < n; i++) {
    k = max(k - 1, 0);
    if (pos[i] == n - 1) {
      k = 0;
    } else {
      int j = sa[pos[i] + 1];
      while (i + k < n && j + k < n && s[i + k] == s[j + k]) {
        k++;
      }
      lcp[pos[i]] = k;
    }
  }
  return lcp;
}
template <typename T>
vector<int> build_lcp(const T& s, const vector<int>& sa) {
  return build_lcp((int)s.size(), s, sa);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  if (n <= 4) {
    vector<int> p(n);
    for (int i = 0; i < n; ++i) {
      p[i] = i;
    }
    vector<int> s;
    do {
      for (int i = 0; i < n; ++i) {
        s.push_back(p[i]);
      }
    } while (next_permutation(p.begin(), p.end()));
    vector<int> sa = suffix_array(s, n);
    vector<int> lcp = build_lcp(s, sa);
    int m = s.size();
    int ans = m * (m + 1) / 2;
    for (int i = 0; i < m - 1; ++i) {
      ans -= lcp[i];
    }
    cout << ans << "\n";
    return 0;
  }
  vector<num> fact(n + 1);
  fact[0] = 1;
  for (int i = 1; i <= n; ++i) {
    fact[i] = fact[i - 1] * i;
  }
  vector<num> h(n * 2);
  h[0] = n;
  h[1] = (num)n * (n - 2) + 2;
  for (int i = 0; i < n - 3; ++i) {
    h[i + 2] = h[i + 1] * (n - i - 2) - fact[n] / fact[n - i] * (n - 4 - i);
  }
  h[n - 1] = fact[n];
  for (int i = 0; i < n - 1; ++i) {
    h[i + n] = fact[n] - h[i];
  }
  num ans = (fact[n] * n) * (fact[n] * n + 1) / 2;
  for (int i = 0; i < n * 2; ++i) {
    ans -= h[i] * i;
  }
  cout << ans << "\n";
  return 0;
}