#include <bits/stdc++.h>
using namespace std;
const int N = 4e5 + 7, p = 998244353, q = 332748118;
int n, k, lim, a[N], b[N], rev[N], dp[N][2], f[N][2];
inline int inc(int a, int b) {
  if (a + b >= p) return a + b - p;
  return a + b;
}
inline int mul(long long a, long long b) { return a * b % p; }
inline int pows(int a, int b) {
  int ans = 1;
  while (b > 0) {
    if (b & 1) ans = mul(a, ans);
    a = mul(a, a), b = b >> 1;
  }
  return ans;
}
inline void NTT(int *s) {
  for (int i = 0; i < lim; i++)
    if (rev[i] < i) swap(s[i], s[rev[i]]);
  for (int d = 1; d < lim; d = d << 1) {
    int w = pows(3, (p - 1) / (d << 1));
    for (int i = 0, r = d << 1; i < lim; i += r) {
      long long wn = 1;
      for (int j = 0; j < d; j++, wn = mul(w, wn)) {
        int a = s[i + j], b = mul(s[i + j + d], wn);
        s[i + j] = inc(a, b), s[i + j + d] = inc(a, p - b);
      }
    }
  }
}
inline void INTT(int *s) {
  for (int i = 0; i < lim; i++)
    if (rev[i] < i) swap(s[i], s[rev[i]]);
  int inv = pows(lim, p - 2);
  for (int d = 1; d < lim; d = d << 1) {
    int w = pows(q, (p - 1) / (d << 1));
    for (int i = 0, r = d << 1; i < lim; i += r) {
      long long wn = 1;
      for (int j = 0; j < d; j++, wn = mul(w, wn)) {
        int a = s[i + j], b = mul(s[i + j + d], wn);
        s[i + j] = inc(a, b), s[i + j + d] = inc(a, p - b);
      }
    }
  }
  for (int i = 0; i < lim; i++) s[i] = mul(s[i], inv);
}
inline void getrev() {
  for (int i = 0; i < lim; i++)
    rev[i] = (rev[i >> 1] >> 1) | ((i & 1) << (k - 1));
}
inline void setmem() {
  for (int i = 0; i < lim; i++) a[i] = 0, b[i] = 0;
}
inline void getans(int l, int r) {
  if (l == r) {
    f[l][0] = inc(f[l][0], mul(mul(mul(l - 1, l - 1), l), dp[l][0])),
    f[l][1] = inc(f[l][1], mul(mul(mul(l - 1, l - 1), l), dp[l - 1][0]));
    return;
  }
  int d = (l + r) >> 1;
  getans(l, d), k = 0, lim = 1;
  while (lim <= r - l + 1) lim = lim << 1, k++;
  lim = lim << 1, k++, getrev();
  setmem();
  for (int i = l; i <= d; i++) a[i - l + 1] = f[i][0];
  for (int i = 1; i <= r - l + 1; i++) b[i] = mul(mul(dp[i][0], i - 1), i - 1);
  NTT(a), NTT(b);
  for (int i = 0; i < lim; i++) a[i] = mul(a[i], b[i]);
  INTT(a);
  for (int i = d + 1; i <= r; i++) f[i][0] = inc(f[i][0], a[i - l + 1]);
  setmem();
  for (int i = l; i <= d; i++) a[i - l + 1] = f[i][1];
  for (int i = 2; i <= r - l + 1; i++)
    b[i] = mul(mul(dp[i - 1][0], i - 1), i - 1);
  NTT(a), NTT(b);
  for (int i = 0; i < lim; i++) a[i] = mul(a[i], b[i]);
  INTT(a);
  for (int i = d + 1; i <= r; i++) f[i][0] = inc(f[i][0], a[i - l + 1]);
  setmem();
  for (int i = l; i <= d; i++) a[i - l + 1] = f[i][0];
  for (int i = 2; i <= r - l + 1; i++)
    b[i] = mul(mul(dp[i - 1][0], i - 1), i - 1);
  NTT(a), NTT(b);
  for (int i = 0; i < lim; i++) a[i] = mul(a[i], b[i]);
  INTT(a);
  for (int i = d + 1; i <= r; i++) f[i][1] = inc(f[i][1], a[i - l + 1]);
  setmem();
  for (int i = l; i <= d; i++) a[i - l + 1] = f[i][1];
  for (int i = 3; i <= r - l + 1; i++)
    b[i] = mul(mul(dp[i - 2][0], i - 1), i - 1);
  NTT(a), NTT(b);
  for (int i = 0; i < lim; i++) a[i] = mul(a[i], b[i]);
  INTT(a);
  for (int i = d + 1; i <= r; i++) f[i][1] = inc(f[i][1], a[i - l + 1]);
  getans(d + 1, r);
}
inline void getsum(int l, int r) {
  if (l == r) {
    f[l][0] = inc(f[l][0], mul(mul(mul(l, l), l + 1), dp[l][0])),
    f[l][1] = inc(f[l][1], mul(mul(mul(l, l), l + 1), dp[l - 1][0]));
    return;
  }
  int d = (l + r) >> 1;
  getsum(l, d), k = 0, lim = 1;
  while (lim <= r - l + 1) lim = lim << 1, k++;
  lim = lim << 1, k++, getrev();
  setmem();
  for (int i = l; i <= d; i++) a[i - l + 1] = f[i][0];
  for (int i = 1; i <= r - l + 1; i++) b[i] = mul(mul(dp[i][0], i - 1), i - 1);
  NTT(a), NTT(b);
  for (int i = 0; i < lim; i++) a[i] = mul(a[i], b[i]);
  INTT(a);
  for (int i = d + 1; i <= r; i++) f[i][0] = inc(f[i][0], a[i - l + 1]);
  setmem();
  for (int i = l; i <= d; i++) a[i - l + 1] = f[i][1];
  for (int i = 2; i <= r - l + 1; i++)
    b[i] = mul(mul(dp[i - 1][0], i - 1), i - 1);
  NTT(a), NTT(b);
  for (int i = 0; i < lim; i++) a[i] = mul(a[i], b[i]);
  INTT(a);
  for (int i = d + 1; i <= r; i++) f[i][0] = inc(f[i][0], a[i - l + 1]);
  setmem();
  for (int i = l; i <= d; i++) a[i - l + 1] = f[i][0];
  for (int i = 2; i <= r - l + 1; i++)
    b[i] = mul(mul(dp[i - 1][0], i - 1), i - 1);
  NTT(a), NTT(b);
  for (int i = 0; i < lim; i++) a[i] = mul(a[i], b[i]);
  INTT(a);
  for (int i = d + 1; i <= r; i++) f[i][1] = inc(f[i][1], a[i - l + 1]);
  setmem();
  for (int i = l; i <= d; i++) a[i - l + 1] = f[i][1];
  for (int i = 3; i <= r - l + 1; i++)
    b[i] = mul(mul(dp[i - 2][0], i - 1), i - 1);
  NTT(a), NTT(b);
  for (int i = 0; i < lim; i++) a[i] = mul(a[i], b[i]);
  INTT(a);
  for (int i = d + 1; i <= r; i++) f[i][1] = inc(f[i][1], a[i - l + 1]);
  getsum(d + 1, r);
}
inline int getdp(int u) {
  if (u < 0) return 0;
  return dp[u][0];
}
int main() {
  cin >> n;
  dp[1][0] = 1;
  for (int i = 1; i <= n + 1; i++)
    dp[i + 3][0] = inc(dp[i + 3][0], dp[i][1]),
           dp[i + 2][0] = inc(dp[i + 2][0], dp[i][0]),
           dp[i + 1][1] = inc(dp[i + 1][1], dp[i][0]);
  getans(1, n - 1);
  int cnt = mul(mul(n, mul(n - 1, n - 1)), inc(dp[n - 2][0], dp[n][0]));
  for (int i = 1; i < n; i++)
    cnt = inc(cnt, mul(mul(n - i - 1, n - i - 1),
                       inc(mul(f[i][0], getdp(n - i)),
                           mul(f[i][1], getdp(n - i - 1)))));
  memset(f, 0, sizeof(f));
  getsum(1, n - 1);
  for (int i = 1; i < n - 2; i++)
    cnt = inc(cnt, mul(mul(n - i - 2, n - i - 2),
                       inc(mul(f[i][0], getdp(n - i - 2)),
                           mul(f[i][1], getdp(n - i - 3)))));
  cout << cnt << endl;
}
