#include <bits/stdc++.h>
clock_t t = clock();
namespace my_std {
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>
inline T rnd(T l, T r) {
  return uniform_int_distribution<T>(l, r)(rng);
}
template <typename T>
inline bool chkmax(T& x, T y) {
  return x < y ? x = y, 1 : 0;
}
template <typename T>
inline bool chkmin(T& x, T y) {
  return x > y ? x = y, 1 : 0;
}
template <typename T>
inline void read(T& t) {
  t = 0;
  char f = 0, ch = getchar();
  double d = 0.1;
  while (ch > '9' || ch < '0') f |= (ch == '-'), ch = getchar();
  while (ch <= '9' && ch >= '0') t = t * 10 + ch - 48, ch = getchar();
  if (ch == '.') {
    ch = getchar();
    while (ch <= '9' && ch >= '0') t += d * (ch ^ 48), d *= 0.1, ch = getchar();
  }
  t = (f ? -t : t);
}
template <typename T, typename... Args>
inline void read(T& t, Args&... args) {
  read(t);
  read(args...);
}
char __sr[1 << 21], __z[20];
int __C = -1, __zz = 0;
inline void Ot() { fwrite(__sr, 1, __C + 1, stdout), __C = -1; }
inline void print(register int x) {
  if (__C > 1 << 20) Ot();
  if (x < 0) __sr[++__C] = '-', x = -x;
  while (__z[++__zz] = x % 10 + 48, x /= 10)
    ;
  while (__sr[++__C] = __z[__zz], --__zz)
    ;
  __sr[++__C] = '\n';
}
void file() {}
inline void chktime() {}
long long ksm(long long x, int y) {
  long long ret = 1;
  for (; y; y >>= 1, x = x * x % 998244353ll)
    if (y & 1) ret = ret * x % 998244353ll;
  return ret;
}
long long inv(long long x) { return ksm(x, 998244353ll - 2); }
}  // namespace my_std
using namespace my_std;
int n;
long long dp[4][4], tmp[4][4];
long long g[2005000], f[2005000][2];
void DP() {
  static int to[4];
  for (int i = (1); i <= (n - 1); i++) {
    for (int k = (0); k <= (3); k++)
      for (int s = (0); s <= (3); s++) {
        long long w = tmp[k][s];
        if (!w) continue;
        for (int p = (0); p <= (3); p++) to[p] = 0;
        if (s == 0)
          to[1]++;
        else if (s == 1)
          to[3]++;
        else if (s == 2)
          to[0]++, to[3]++;
        else
          to[2]++;
        for (int t = (0); t <= (3); t++)
          if ((t & k) == k)
            for (int p = (0); p <= (3); p++)
              (dp[t][p] += w * to[p] % 998244353ll) %= 998244353ll;
        if (k != 3) continue;
        if (!(s >> 1 & 1)) continue;
        (dp[0][(s ^ 2) << 1 | 1] += w) %= 998244353ll;
        (f[i + 1][s & 1] += w) %= 998244353ll;
      }
    for (int k = (0); k <= (3); k++)
      for (int s = (0); s <= (3); s++) tmp[k][s] = dp[k][s], dp[k][s] = 0;
  }
  memcpy(dp, tmp, sizeof(dp));
  g[0] = g[2] = 1;
  for (int i = (2); i <= (n / 2); i++)
    g[i * 2] = (g[(i - 1) * 2] + g[(i - 2) * 2]) % 998244353ll;
}
int main() {
  file();
  read(n);
  long long ans = 0;
  memset(dp, 0, sizeof(dp)), memset(tmp, 0, sizeof(tmp)),
      memset(f, 0, sizeof(f)), memset(g, 0, sizeof(g));
  tmp[0][3] = 1;
  DP();
  f[1][1] = 1;
  for (int i = (1); i <= (n - 1); i++) {
    long long w = 0;
    (w += f[n - i][1] * g[i] % 998244353ll) %= 998244353ll;
    (w += f[n - i][0] * g[i - 1] % 998244353ll) %= 998244353ll;
    (ans += w * (i + 1) % 998244353ll * i % 998244353ll * i % 998244353ll) %=
        998244353ll;
  }
  memset(dp, 0, sizeof(dp)), memset(tmp, 0, sizeof(tmp)),
      memset(f, 0, sizeof(f)), memset(g, 0, sizeof(g));
  for (int i = (0); i <= (3); i++) dp[i][3] = 1;
  DP();
  f[1][0] = 1;
  for (int i = (1); i <= (n - 1); i++) {
    long long w = 0;
    (w += f[n - i][1] * g[i - 1] % 998244353ll) %= 998244353ll;
    (w += f[n - i][0] * (i == 1 ? 0ll : g[i - 2]) % 998244353ll) %= 998244353ll;
    (ans += w * (i + 1) % 998244353ll * i % 998244353ll * i % 998244353ll) %=
        998244353ll;
  }
  cout << ans;
  return 0;
}
