#include <bits/stdc++.h>
using namespace std;
namespace mine {
long long qread() {
  long long ans = 0, f = 1;
  char c = getchar();
  while (c < '0' or c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while ('0' <= c and c <= '9') ans = ans * 10 + c - '0', c = getchar();
  return ans * f;
}
void write(long long num) {
  if (num < 0) putchar('-'), num = -num;
  if (num >= 10) write(num / 10);
  putchar('0' + num % 10);
}
void write1(long long num) {
  write(num);
  putchar(' ');
}
void write2(long long num) {
  write(num);
  putchar('\n');
}
template <typename T>
inline bool chmax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
template <typename T>
inline bool chmin(T &a, const T &b) {
  return a > b ? a = b, 1 : 0;
}
long long gcd(long long x, long long y) { return y ? gcd(y, x % y) : x; }
bool IN(long long x, long long l, long long r) { return l <= x and x <= r; }
void GG() {
  puts("No");
  exit(0);
}
const double eps = 1e-8;
const int INF = 0x3f3f3f3f;
const int MOD = 998244353;
int mm(const int x) { return x >= MOD ? x - MOD : x; }
template <typename T>
void add(T &x, const int &y) {
  x = (x + y >= MOD ? x + y - MOD : x + y);
}
long long qpower(long long x, long long e, int mod = MOD) {
  long long ans = 1;
  while (e) {
    if (e & 1) ans = ans * x % mod;
    x = x * x % mod;
    e >>= 1;
  }
  return ans;
}
long long invm(long long x) { return qpower(x, MOD - 2); }
const int N = 2e6 + 10;
int F[N];
int getF(int x) { return x >= 0 and x % 2 == 0 ? F[x / 2] : 0; }
int dp[N][4][2][3];
void main() {
  F[0] = F[1] = 1;
  for (int i = (2), I = (N - 1); i <= I; i++) F[i] = mm(F[i - 1] + F[i - 2]);
  int n = qread(), ans = 0;
  dp[0][0][1][2] = 1;
  for (int i = (1), I = (n - 1); i <= I; i++)
    for (int s2 = (0), I = (3); s2 <= I; s2++)
      for (int s3 = (0), I = (3); s3 <= I; s3++)
        if ((s2 & s3) == 0)
          for (int a = (0), I = (1); a <= I; a++)
            for (int b = (0), I = (2); b <= I; b++) {
              int X = dp[i - 1][s2][a][b];
              if (!X) continue;
              if (a == 0)
                add(dp[i][s2 | s3][min(b, 1)][1], X);
              else {
                if (b == 0) add(dp[i][s2 | s3][1][1], X);
                add(dp[i][s2 | s3][min(b, 1)][0], X);
                if (s3 == 0 and s2 == 3) {
                  assert(b != 2);
                  add(dp[i][0][b][2], X);
                }
              }
            }
  for (int i = (0), I = (n - 1); i <= I; i++) {
    long long now;
    if ((n - i - 1) % 2 == 0)
      now = 1ll * dp[i][0][1][2] * (n - i - 1) % MOD * (n - i - 1) % MOD *
            getF(n - i - 1) % MOD;
    else
      now = 1ll * dp[i][0][0][2] * (n - i - 1) % MOD * (n - i - 1) % MOD *
            getF(n - i - 2) % MOD;
    add(ans, now * (n - i) % MOD);
  }
  memset(dp, 0, sizeof dp);
  for (int s = (0), I = (3); s <= I; s++) dp[1][s][1][1] = 1;
  for (int i = (2), I = (n - 1); i <= I; i++)
    for (int s2 = (0), I = (3); s2 <= I; s2++)
      for (int s3 = (0), I = (3); s3 <= I; s3++)
        if ((s2 & s3) == 0)
          for (int a = (0), I = (1); a <= I; a++)
            for (int b = (0), I = (2); b <= I; b++) {
              int X = dp[i - 1][s2][a][b];
              if (!X) continue;
              if (a == 0)
                add(dp[i][s2 | s3][min(b, 1)][1], X);
              else {
                if (b == 0) add(dp[i][s2 | s3][1][1], X);
                add(dp[i][s2 | s3][min(b, 1)][0], X);
                if (s3 == 0 and s2 == 3) {
                  assert(b != 2);
                  add(dp[i][0][b][2], X);
                }
              }
            }
  for (int i = (0), I = (n - 1); i <= I; i++) {
    long long now;
    if (i == 0)
      now = 1ll * (n - 1) * (n - 1) % MOD * getF(n - 3) % MOD;
    else if ((n - i - 2) % 2 == 0)
      now = 1ll * dp[i][0][1][2] * (n - i - 1) % MOD * (n - i - 1) % MOD *
            getF(n - i - 2) % MOD;
    else
      now = 1ll * dp[i][0][0][2] * (n - i - 1) % MOD * (n - i - 1) % MOD *
            getF(n - i - 3) % MOD;
    add(ans, now * (n - i) % MOD);
  }
  write(ans);
}
};  // namespace mine
signed main() {
  mine::main();
  ;
}
