#include <bits/stdc++.h>
using namespace std;
const int _p = 998244353;
int n;
const int N = 50005, M = 40;
template <class V, int M>
struct Poly {
  V a[M];
  Poly() { memset(a, 0, sizeof(a)); }
  Poly(const vector<int> &t) {
    memset(a, 0, sizeof(a));
    for (int i = 0; i + 1 < (int)t.size(); i += 2) a[t[i]] = t[i + 1];
  }
  inline V &operator[](int x) { return a[x]; }
  inline V operator[](int x) const { return a[x]; }
  inline friend Poly operator+(const Poly &a, const Poly &b) {
    Poly c;
    for (int i = (0); i < (M); i++) c[i] = (a[i] + b[i]) % _p;
    return c;
  }
  inline friend Poly operator-(const Poly &a, const Poly &b) {
    Poly c;
    for (int i = (0); i < (M); i++) c[i] = (a[i] - b[i]) % _p;
    return c;
  }
  inline friend Poly operator*(const Poly &a, const Poly &b) {
    Poly c;
    for (int i = (0); i < (M); i++)
      for (int j = 0; i + j < M; j++)
        c[i + j] += a[i] * b[j] % _p, c[i + j] %= _p;
    return c;
  }
  inline friend Poly<int, N> operator/(Poly a, const Poly &b) {
    Poly<int, N> c;
    for (int i = (0); i < (40); i++) c[i] = a[i];
    for (int i = (0); i < (n + 1); i++)
      for (int j = (1); j < (min(i, 39) + 1); j++)
        c[i] += (long long)c[i - j] * (-b[j] + (!j)) % _p, c[i] %= _p;
    return c;
  }
  inline friend Poly operator<<(const Poly &a, int k) {
    Poly c;
    for (int i = (0); i < (M - k); i++) c[i] = a[i + k];
    return c;
  }
  inline friend Poly operator>>(const Poly &a, int k) {
    Poly c;
    for (int i = (M)-1; i >= (k); i--) c[i] = a[i - k];
    return c;
  }
  inline friend Poly operator^(Poly a, long long k) {
    Poly c;
    c[0] = 1;
    for (; k; k >>= 1, a = a * a)
      if (k & 1) c = c * a;
    return c;
  }
  inline friend Poly sqr(const Poly &a) { return a * a; }
  inline void print() const {
    printf("\n\n\n");
    for (int i = (0); i < (M); i++) printf("a[%d]=%d\n", i, a[i]);
    printf("\n\n\n");
  }
};
long long h(long long x) { return x * (x - 1) % _p * (x - 1) % _p; }
Poly<int, 40> FM, FZ, Q({0, 1, 2, -3, 6, 5, 10, -3, 12, -1}),
    P0({2, 4, 4, 20, 6, 12, 8, 16}), P1({0, 1, 2, 6, 4, 23, 6, 2, 8, 9}),
    P2({0, 4, 2, 4, 4, 24, 6, -4, 8, 4});
Poly<int, N> F0, F1, F2;
int m, x, g[N];
long long ans = 0, ret;
void file_put() {
  freopen("filename.in", "r", stdin);
  freopen("filename.out", "w", stdout);
}
int main() {
  scanf("%d", &n);
  g[0] = g[2] = 1;
  for (int i = (4); i < (N); i++) g[i] = ((long long)g[i - 2] + g[i - 4]) % _p;
  FM = ((P0 >> 1) - Q) * ((P2 >> 3) - Q) - (sqr(P1) >> 4);
  FZ = P1 * Q;
  F0 = ((sqr(P1) >> 3) - P0 * ((P2 >> 3) - Q)) / FM;
  F1 = FZ / FM;
  F2 = (FM * P2 + (P1 * FZ >> 1)) / (FM * (Q - (P2 >> 3)));
  ans = (g[n - 1] + g[n - 3]) * h(n) % _p;
  for (int i = (2); i < (n - 1); i++) {
    ret = (long long)g[i - 1] * F0[n - i - 1] % _p;
    ret += 2ll * g[i - 2] * F1[n - i - 2] % _p;
    if (i >= 3 && i <= n - 3) ret += (long long)g[i - 3] * F2[n - i - 3] % _p;
    ret %= _p;
    ans += ret * h(i) % _p;
  }
  ans %= _p, ans = (ans + _p) % _p;
  printf("%lld\n", ans);
  return 0;
}
