The Floral Clock has been standing by the side of Mirror Lake for years. Though unable to keep time, it reminds people of the passage of time and the good old days.On the rim of the Floral Clock are 2n flowers, numbered from 1 to 2n clockwise, each of which has a colour among all n possible ones. For each colour, there are exactly two flowers with it, the distance between which either is less than or equal to 2, or equals n. Additionally, if flowers u and v are of the same colour, then flowers opposite to u and opposite to v should be of the same colour as well — symmetry is beautiful!Formally, the distance between two flowers is 1 plus the number of flowers on the minor arc (or semicircle) between them. Below is a possible arrangement with n = 6 that cover all possibilities.  The beauty of an arrangement is defined to be the product of the lengths of flower segments separated by all opposite flowers of the same colour. In other words, in order to compute the beauty, we remove from the circle all flowers that have the same colour as flowers opposite to them. Then, the beauty is the product of lengths of all remaining segments. Note that we include segments of length 0 in this product. If there are no flowers that have the same colour as flower opposite to them, the beauty equals 0. For instance, the beauty of the above arrangement equals 1 × 3 × 1 × 3 = 9 — the segments are {2}, {4, 5, 6}, {8} and {10, 11, 12}.While keeping the constraints satisfied, there may be lots of different arrangements. Find out the sum of beauty over all possible arrangements, modulo 998 244 353. Two arrangements are considered different, if a pair (u, v) (1 ≤ u, v ≤ 2n) exists such that flowers u and v are of the same colour in one of them, but not in the other.

The first and only line of input contains a lonely positive integer n (3 ≤ n ≤ 50 000) — the number of colours present on the Floral Clock.

Output one integer — the sum of beauty over all possible arrangements of flowers, modulo 998 244 353.

NoteWith n = 3, the following six arrangements each have a beauty of 2 × 2 = 4.  While many others, such as the left one in the figure below, have a beauty of 0. The right one is invalid, since it's asymmetric.

#include<bits/stdc++.h>
#define _ %mod
#define N 50010
using namespace std;
const int mod=998244353;
int n,L,R[1<<18],p[1<<18],q[1<<18];
int add(int a){return a<mod?a:a-mod;}
int dec(int a){return a<0?a+mod:a;}
int mi(int a,int b)
{
    int res=1;
    while(b)
    {
        if(b&1)res=1ll*res*a _;
        a=1ll*a*a _;
        b>>=1;
    }
    return res;
}
void fft(int x[],int n,int f)
{
    for(int i=0;i<n;++i)
        if(i<R[i])
            swap(x[i],x[R[i]]);
    for(int i=1;i<n;i<<=1)
    {
        int wn=mi(3,(mod-1)/(i<<1));
        if(!~f)wn=mi(wn,mod-2);
        for(int j=0;j<n;j+=i<<1)
            for(int k=0,w=1;k<i;++k,w=1ll*w*wn _)
            {
                int l=x[j+k],r=1ll*w*x[i+j+k] _;
                x[j+k]=add(l+r);x[i+j+k]=dec(l-r);
            }
    }
    if(!~f)
    {
        int inv=mi(n,mod-2);
        for(int i=0;i<n;++i)
            x[i]=1ll*x[i]*inv _;
    }
}
int g[N],sqr[N];
struct node
{
    int n;
    vector<int> x;
    node(){n=0;}
    node operator * (const node &e)const
    {
        node res;
        int m=e.n;
        res.n=n+m;
        int nn;L=0;
        for(nn=1;nn<=n+m;nn<<=1)++L;--L;
        for(int i=0;i<nn;++i)R[i]=(R[i>>1]>>1)|((i&1)<<L);
        for(int i=0;i<nn;++i)p[i]=q[i]=0;
        for(int i=0;i<=n;++i)p[i]=x[i];
        for(int i=0;i<=m;++i)q[i]=e.x[i];
        fft(p,nn,1);fft(q,nn,1);
        for(int i=0;i<nn;++i)
            p[i]=1ll*p[i]*q[i] _;
        fft(p,nn,-1);
        for(int i=0;i<=n+m;++i)
            res.x.push_back(p[i]);
        return res;
    }
    node operator % (const int &a)const
    {
        node res=*this;
        while(res.n>=a)
            --res.n,res.x.pop_back();
        return res;
    }
}f0,f1,f2;
void add(node &a,node b,int be)
{
	for(int i=0;i<=a.n;++i)if(i+be>=0)
		a.x[i]=(a.x[i]+b.x[i+be]) _;
}
void solve(int n)
{
	if(n==0)return;
	int m=n>>1;
	node e0,e1,e2;e0.n=e1.n=e2.n=n-m-1;
	for(int i=m+1;i<=n;++i)
		e0.x.push_back(f0.x[i]),
		e1.x.push_back(f1.x[i]),
		e2.x.push_back(f2.x[i]);
	f0=f0%(m+1);f1=f1%(m+1);f2=f2%(m+1);
	solve(m);
	node g0,g1,g2;g0.n=g1.n=g2.n=n;
	for(int i=0;i<=n;++i)
		g0.x.push_back(1ll*g[i]*sqr[i] _),
		g1.x.push_back(1ll*g[i]*sqr[i+1] _),
		g2.x.push_back(1ll*g[i]*sqr[i+2] _);
	add(e0,f0*g0,m);add(e0,f1*g1,m-2);
	add(e1,f0*g1,m);add(e1,f1*g2,m-2);
	add(e2,f1*g1,m);add(e2,f2*g2,m-2);
	node a=f0,b=f1,c=f2;
	f0=e0;f1=e1;f2=e2;
	solve(n-m-1);
	for(int i=m+1;i<=n;++i)
		a.x.push_back(f0.x[i-m-1]),
		b.x.push_back(f1.x[i-m-1]),
		c.x.push_back(f2.x[i-m-1]);
	a.n=b.n=c.n=n;
	f0=a;f1=b;f2=c;
}
int main()
{
	scanf("%d",&n);
	g[0]=g[2]=1;
	for(int i=4;i<=n+3;++i)g[i]=(g[i-2]+g[i-4]) _;
	for(int i=1;i<=n+3;++i)sqr[i]=1ll*i*i _;
	f0.n=f1.n=f2.n=n;
	for(int i=0;i<=n;++i)
		f0.x.push_back(1ll*g[i]*sqr[i] _),
		f1.x.push_back(1ll*g[i]*sqr[i+1] _),
		f2.x.push_back(1ll*g[i]*sqr[i+2] _);
	solve(n);
	int ans=1ll*sqr[n-1]*(g[n-1]+g[n-3]) _*n _;
	for(int i=3;i<n;++i)
	{
		ans=(ans+1ll*sqr[i-2]*g[i-2] _*f0.x[n-i] _*(i-1)) _;
		ans=(ans+1ll*sqr[i-2]*g[i-3] _*f1.x[n-i-1] _*2*(i-1)) _;
		if(i>=4 && i+1<n)ans=(ans+1ll*sqr[i-2]*g[i-4] _*f2.x[n-i-2] _*(i-1)) _;
	}
	printf("%d\n",ans _);
}

#include<bits/stdc++.h>
using namespace std;
const int maxn = 50000 + 10;
const int MOD = 998244353;
const int LEN = 131072 + 10;

inline int inc(int a, int b) { return (a + b >= MOD) ? (a + b - MOD) : (a + b); }
inline int dec(int a, int b) { return (a >= b) ? (a - b) : (a + MOD - b); }
inline int mul(int a, int b) { return 1LL * a * b % MOD; }

inline void updata(int &x, int y) { x = inc(x,y); }

inline int power(int x, int k) {
	int tmp = 1;
	while(k) {
		if(k & 1) tmp = mul(tmp,x);
		x = mul(x,x);
		k >>= 1;
	}
	return tmp;
}

inline void rader(int *a, int len) {
	for(int i = 0, j = 0;i < len - 1;i ++) {
		if(i < j) swap(a[i],a[j]);
		int k = (len >> 1);
		while(j >= k) {
			j -= k;
			k >>= 1;
		}
		if(j < k) j += k;
	}
}

inline void ntt(int *a, int len, int kd) {
	rader(a,len);
	for(int i = 2;i <= len;i <<= 1) {
		int pn = power(3,(MOD - 1) / i);
		for(int j = 0;j < len;j += i) {
			int p = 1;
			for(int k = 0;k < (i >> 1);k ++) {
				int x = a[k + j], y = mul(a[k + j + (i >> 1)],p);
				a[k + j] = inc(x,y);
				a[k + j + (i >> 1)] = dec(x,y);
				p = mul(p,pn);
			}
		}
	}
	if(kd == -1) {
		for(int i = 1;i < (len >> 1);i ++) swap(a[i],a[len - i]);
		int invn = power(len,MOD - 2);
		for(int i = 0;i < len;i ++) a[i] = mul(a[i],invn);
	}
}

int ta[LEN], tb[LEN];
inline void Mul(int *c, int *a, int *b, int len) {
//	int len = 1;
//	while(len <= l1 + l2) len <<= 1;
//	for(int i = 0;i <= l1;i ++) ta[i] = a[i];
//	for(int i = 0;i <= l2;i ++) tb[i] = b[i];
//	for(int i = l1 + 1;i <= len;i ++) ta[i] = 0;
//	for(int i = l2 + 1;i <= len;i ++) tb[i] = 0;
//	ntt(ta,len,1);
//	ntt(tb,len,1);
	for(int i = 0;i < len;i ++) ta[i] = mul(a[i],b[i]);
	ntt(ta,len,-1);
	for(int i = 0;i < len;i ++) c[i] = ta[i];
}

int g[maxn], n, f[3][LEN], F[3][LEN];
int G[4][LEN], t1[LEN], t2[LEN];
int tG[3][LEN];

void solve(int l, int r) {
	if(l == r) {
		if(!l) return;
		for(int i = 0;i < 3;i ++) updata(f[i][l],G[i][l]);
		return;
	}
	int mid = (l + r) >> 1, l1 = mid - l, len = r - l + 1;
	solve(l,mid);
	for(int i = 0;i <= l1;i ++) {
		for(int j = 0;j < 3;j ++) F[j][i] = f[j][i + l];
	}
	int LEN = 1;
	while(LEN <= l1 + len) LEN <<= 1;
	for(int i = l1 + 1;i <= LEN;i ++) {
		for(int j = 0;j < 3;j ++) F[j][i] = 0;
	}
	for(int i = 0;i < 3;i ++) ntt(F[i],LEN,1);

	for(int i = 0;i <= len;i ++) {
		for(int j = 0;j < 3;j ++) tG[j][i] = G[j][i];
	}
	for(int i = len + 1;i <= LEN;i ++) {
		for(int j = 0;j < 3;j ++) tG[j][i] = 0;
	}
	for(int i = 0;i < 3;i ++) ntt(tG[i],LEN,1);

	//calc 0
	Mul(t1,tG[0],F[0],LEN);
	Mul(t2,tG[1],F[1],LEN);
	for(int i = mid + 1;i <= r;i ++) {
		if(i - l) updata(f[0][i],t1[i - l - 1]);
		if(i - l >= 3) updata(f[0][i],t2[i - l - 3]);
	}

	//calc 1
	Mul(t1,tG[1],F[0],LEN);
	Mul(t2,tG[2],F[1],LEN);
	for(int i = mid + 1;i <= r;i ++) {
		if(i - l) updata(f[1][i],t1[i - l - 1]);
		if(i - l >= 3) updata(f[1][i],t2[i - l - 3]);
	}

	//calc 2
	Mul(t1,tG[1],F[1],LEN);
	Mul(t2,tG[2],F[2],LEN);
	for(int i = mid + 1;i <= r;i ++) {
		if(i - l) updata(f[2][i],t1[i - l - 1]);
		if(i - l >= 3) updata(f[2][i],t2[i - l - 3]);
	}

	solve(mid + 1,r);
}

inline void debug() {
	return;
	int pos[10];
	for(int i = 0;i < 8;i ++) pos[i] = i;
	ntt(pos,8,1);
	ntt(pos,8,-1);
	for(int i = 0;i < 8;i ++) printf("%d\n", pos[i]);
}

int main() {
//	freopen("data.in","r",stdin);
//	debug();
	scanf("%d", &n);
	g[0] = 1; g[2] = 1;
	for(int i = 4;i <= n;i += 2) g[i] = inc(g[i - 2],g[i - 4]);
	f[0][0] = 0; f[1][0] = 1; f[2][0] = 4;
	for(int i = 0;i <= n;i ++) {
		for(int j = 0;j < 4;j ++) G[j][i] = mul(g[i],mul(inc(i,j),inc(i,j)));
	}
  solve(0,n);
	//debug
	/*
	for(int i = 0;i <= 2;i ++) {
		printf("f[%d]\n", i);
		for(int j = 0;j <= n;j ++) printf("%d ", f[i][j]);
		puts(""); puts("");
	}
	*/

	int Ans = mul(n,mul(g[n - 1],mul(n - 1,n - 1)));
	if(n >= 3) updata(Ans,mul(n,mul(g[n - 3],mul(n - 1,n - 1))));
	for(int i = 0;i <= n - 2;i ++) {
		int now = mul(mul(g[i],mul(i,i)),f[0][n - i - 2]);
		if(i && n - i - 3 >= 0) updata(now,mul(2,mul(mul(g[i - 1],mul(i,i)),f[1][n - i - 3])));
		if(i - 2 >= 0 && n - i - 4 >= 0) updata(now,mul(mul(g[i - 2],mul(i,i)),f[2][n - i - 4]));
//		cout << i << ' ' << mul(now,inc(i,1)) << endl;
		updata(Ans,mul(now,inc(i,1)));
	}
	printf("%d\n", Ans);
	return 0;
}

#include <bits/stdc++.h>
using namespace std;

const int N = 55000;
const int MOD = 998244353;

int modExp(int a, int n, int p) {
	int ret = 1;
	for (; n; n >>= 1, a = 1LL * a * a % p) if (n & 1) ret = 1LL * ret * a % p;
	return ret;
}

using VI = vector<int>;

VI operator+(VI lhs, VI rhs) {
	VI ret(max(lhs.size(), rhs.size()), 0);
	for (int i = 0; i < ret.size(); i++) ret[i] = ((i < lhs.size() ? lhs[i] : 0) + (i < rhs.size() ? rhs[i] : 0)) % MOD;
	return ret;
}

VI operator-(VI lhs, VI rhs) {
	VI ret(max(lhs.size(), rhs.size()), 0);
	for (int i = 0; i < ret.size(); i++) ret[i] = ((i < lhs.size() ? lhs[i] : 0) + (i < rhs.size() ? MOD - rhs[i] : 0)) % MOD;
	return ret;
}

VI operator*(VI lhs, VI rhs) {
	VI ret((int)lhs.size() + rhs.size() - 1, 0);
	for (int i = 0; i < lhs.size(); i++) {
		for (int j = 0; j < rhs.size(); j++) {
			ret[i + j] = (ret[i + j] + lhs[i] * 1LL * rhs[j]) % MOD;
		}
	}
	return ret;
}

VI dot(VI &a) {
	if (a.size() == 1) { return {0}; }
	VI ret(a.size() - 1, 0);
	for (int i = 0; i < ret.size(); i++) ret[i] = a[i+1] * 1LL * (i+1) % MOD;
	return ret;
}

VI operator*(VI a, int k) {
	VI ret(a.size(), 0);
	for (int i = 0; i < a.size(); i++) ret[i] = a[i] * 1LL * k % MOD;
	return ret;
}

struct GF {
	VI p, q; // p/q
	GF(VI p = VI(), VI q = VI()) : p(p), q(q) {}
	GF operator+(GF rhs) {
		return GF(p * rhs.q + q * rhs.p, q * rhs.q);
	}
	GF operator-(GF rhs) {
		return GF(p * rhs.q - q * rhs.p, q * rhs.q);
	}
	GF operator*(int k) {
		return GF(p * k, q);
	}
} e[3], E[3], g, h, x, xx, yy, z, y;

GF operator*(GF lhs, GF rhs) {
	return GF(lhs.p * rhs.p, lhs.q * rhs.q);
}

GF dot(GF &g) {
	return GF(dot(g.p) * g.q - dot(g.q) * g.p, g.q * g.q);
}

GF inv(GF &g) {
	return GF(g.q, g.p);
}

int a[N], b[N], c[N];

void extract(GF y, int n) {
	b[0] = 1;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j < y.q.size(); j++) {
			if (j > i) break;
			b[i] = (b[i] + 1LL * (MOD - y.q[j]) * b[i - j]) % MOD;
		}
	}
	for (int i = n; i >= 0; i--) {
		for (int j = 0; j < y.p.size(); j++) {
			if (j > i) break;
			a[i] = (a[i] + 1LL * b[i - j] * y.p[j]) % MOD;
		}
	}
}

int main() {
	int n; scanf("%d", &n);
	e[0] = GF({1}, {1, 0, MOD-1, 0, MOD-1});
	e[1] = dot(e[0]) * GF({0, 1}, {1});
	e[2] = dot(e[1]) * GF({0, 1}, {1});
	E[0] = e[2];
	E[1] = e[2] + e[1] * 2 + e[0];
	E[2] = e[2] + e[1] * 4 + e[0] * 4;
	g = GF({1}, {1}) - GF({0, 1}, {1}) * E[0];
	g = inv(g) * E[1];
	h = g * E[1];
	h = h * GF({0, 1}, {1});
	h = h + E[2];
	x = h * GF({0, 0, 0, 1}, {1});
	xx = dot(x);
	yy = GF({1}, {1}) - x;
	yy = inv(yy);
	z = yy * xx;
	y = GF({0}, {1});
	y = y + z * GF({0, 1}, {1});
	x = E[0] * GF({0, 1}, {1});
	xx = dot(x);
	yy = GF({1}, {1}) - x;
	yy = inv(yy);
	z = yy * xx;
	y = y + z * GF({0, 1}, {1});
	extract(y, n);
	cout << a[n] << endl;
	return 0;
}

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<vector>
#include<map>
#define int long long
using namespace std;
const int maxn = 2e5+10;
const int mod = 998244353;

int read(){
	int x=0,f=1;
	char c=getchar();
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c)){x=(x<<3)+(x<<1)+c-48;c=getchar();}
	return x*f;
}

int fpm(int x,int y){
	int sum=1;
	while(y){if(y&1)sum=sum*x%mod;x=x*x%mod;y>>=1;}
	return sum;
}

int g=3,invg=fpm(3,mod-2),len=1,L=0,w[maxn];
int A0[maxn],A1[maxn],A2[maxn],B00[maxn],B01[maxn],B10[maxn],B11[maxn],p[maxn];
void init(){
	for(register int i=0;i<=len;i++){
		w[i]=(w[i>>1]>>1) | ((i&1)<<(L-1));
		p[i]=A0[i]=A1[i]=A2[i]=B00[i]=B01[i]=B10[i]=B11[i]=0;
	}
}
void NTT(int *f,int op){
	for(register int i=0;i<len;i++){
		if(i<w[i])swap(f[i],f[w[i]]);
	}
	for(register int j=1;j<len;j<<=1){
		int tmp=fpm(op?g:invg,(mod-1)/(j<<1));
		for(register int k=0;k<len;k+=(j<<1)){
			int t=1;
			for(register int l=0;l<j;l++,t=t*tmp%mod){
				int a1=f[k+l],a2=f[k+l+j]*t%mod;
				(f[k+l]=a1+a2)%=mod;
				(f[k+l+j]=a1-a2+mod)%=mod;
			}
		}
	}
	if(op<=0){
		int invn=fpm(len,mod-2);
		for(register int i=0;i<len;i++)f[i]=f[i]*invn%mod;
	}
}

int k,m,n,S[maxn],w0[maxn],w1[maxn],w2[maxn];
int f00[maxn],f01[maxn],f10[maxn],f11[maxn];
void solve(int l,int r){
	if(l>r)return;
	if(l==r){
		//cout<<f00[l]<<" "<<f01[l]<<" "<<f10[l]<<" "<<f11[l]<<" "<<l<<endl;
		(f00[l]+=w0[l]*l%mod)%=mod;
		(f01[l]+=w1[l]*l%mod)%=mod;
		(f10[l]+=w1[l]*l%mod)%=mod;
		(f11[l]+=w2[l]*l%mod)%=mod;
		//cout<<f00[l]<<" "<<f01[l]<<" "<<f10[l]<<" "<<f11[l]<<" "<<l<<endl;
		return;
	}

	int mid=(l+r)>>1;
	solve(l,mid);
	int n=mid-l,m=r-l;len=1;L=0;
	while(len<=n+m)len<<=1,L++;
	init();
	for(register int i=0;i<=m;i++){
		A0[i]=w0[i];A1[i]=w1[i];A2[i]=w2[i];
	//	cout<<A0[i]<<" "<<A1[i]<<" "<<A2[i]<<endl;
	}
	for(register int i=0;i<=n;i++){
		B00[i]=f00[l+i];B01[i]=f01[l+i];
		B10[i]=f10[l+i];B11[i]=f11[l+i];
	//	cout<<l<<" "<<mid<<" "<<r<<" "<<B00[i]<<" "<<B01[i]<<" "<<B10[i]<<" "<<B11[i]<<endl;
	}
	NTT(A0,1);NTT(A1,1);NTT(A2,1);
	NTT(B00,1);NTT(B01,1);NTT(B10,1);NTT(B11,1);
	for(register int i=0;i<len;i++)(p[i]=B00[i]*A0[i]%mod+B01[i]*A1[i]%mod)%=mod;
	NTT(p,0);
	for(register int i=n+1;i<=m;i++)(f00[l+i]+=p[i])%=mod;
	for(register int i=0;i<len;i++)(p[i]=B00[i]*A1[i]%mod+B01[i]*A2[i]%mod)%=mod;
	NTT(p,0);
	for(register int i=n+1;i<=m;i++)(f01[l+i]+=p[i])%=mod;
	for(register int i=0;i<len;i++)(p[i]=B10[i]*A0[i]%mod+B11[i]*A1[i]%mod)%=mod;
	NTT(p,0);
	for(register int i=n+1;i<=m;i++)(f10[l+i]+=p[i])%=mod;
	for(register int i=0;i<len;i++)(p[i]=B10[i]*A1[i]%mod+B11[i]*A2[i]%mod)%=mod;
	NTT(p,0);
	for(register int i=n+1;i<=m;i++)(f11[l+i]+=p[i])%=mod;
	solve(mid+1,r);
	return;
}

signed main(){
	n=read();
	S[0]=1;
	for(register int i=2;i<=n;i++){
		S[i]+=S[i-2];
		if(i>=4)(S[i]+=S[i-4])%=mod;
	}
	for(register int i=2;i<=n;i++){
		w0[i]=S[i-1]*(i-1)%mod*(i-1)%mod;
		w1[i]=S[i-2]*(i-1)%mod*(i-1)%mod;
		if(i>=3)
		w2[i]=S[i-3]*(i-1)%mod*(i-1)%mod;
	}
	solve(1,n);
	printf("%lld\n",(f00[n]+f11[n])%mod);
	return 0;
}

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define REP(i,n) for(int i=(0);i<(n);i++)
#define pb push_back
using namespace std;
typedef vector<int> vi;
typedef long long ll;

const int N=5005,mod=998244353;
namespace {
	inline int add(int x,int y){
		return x+y>=mod?x+y-mod:x+y;
	}
	inline void Add(int &x,int y){
		x=add(x,y);
	}
	inline int mnu(int x,int y){
		return x-y<0?x-y+mod:x-y;
	}
	inline int mul(int x,int y){
		return (ll)x*y%mod;
	}
	inline int power(int x,ll p){
		int res=1;
		for(;p;p>>=1,x=(ll)x*x%mod)
			if(p&1)res=(ll)res*x%mod;
		return res;
	}
	#define inv(x) power(x,mod-2)
}
namespace LS{
	/*
	note:
	所有下标均从零开始
	a[i]=\sum a[i-j-1]*r[j]
	初值为a[0]..a[sz-1]
	*/
	int p[N],d[N],m;vi s[N];
	vi BM(vi a){
		int n=a.size();
		for(;m;)s[m--].clear();
		REP(i,n){
			d[i]=a[i];
			REP(j,s[m].size())
				d[i]=mnu(d[i],mul(a[i-j-1],s[m][j]));
			if(!d[i])continue;
			p[m]=i;
			if(!m){s[++m].resize(i+1);continue;}
			int id=m-1;
			REP(j,m-1)
				id=(p[j]-s[j].size()>p[id]-s[id].size()?j:id);
			int coef=mul(d[i],inv(d[p[id]]));
			s[++m].resize(i-p[id]-1);
			s[m].pb(coef);
			REP(j,s[id].size())
				s[m].pb(mul(mod-coef,s[id][j]));
			REP(j,s[m-1].size())
				if(j<s[m].size())s[m][j]=add(s[m][j],s[m-1][j]);
				else s[m].pb(s[m-1][j]);
		}
		return s[m];
	}
	const ll Mod=(ll)mod*mod*8;
	#define fix(x) (x>=Mod?x-=Mod:0);
	int A[N],B[N],bin[N],res[N],n;
	inline void Mul(int *x,int *y){
		static ll t[N<<1];
		rep(k,0,n*2-2)t[k]=0;
		REP(i,n)REP(j,n)
			t[i+j]+=(ll)x[i]*y[j],fix(t[i+j]);
		per(i,n*2-2,n){
			t[i]%=mod;
			REP(j,n)t[i-j-1]+=t[i]*A[j],fix(t[i-j-1]);
			t[i]=0;
		}
		REP(i,n)x[i]=t[i]%mod;
	}
	int solve(vi a,vi b,ll K){
		n=a.size();
		if(K<=n-1)return b[K];
		if(n==1)return mul(b[0],power(a[0],K));
		REP(i,n){
			bin[i]=res[i]=0;
			A[i]=a[i],B[i]=b[i];
		}
		bin[1]=res[0]=1;
		for(K-=n-1;K;K>>=1,Mul(bin,bin))
			if(K&1)Mul(res,bin);
		rep(i,n,n*2-2){
			B[i]=0;
			REP(j,n)B[i]=add(B[i],mul(B[i-j-1],A[j]));
		}
		int s=0;
		REP(i,n)s=add(s,mul(B[n-1+i],res[i]));
		return s;
	}
	int gao(vi x,ll K){
	//	vi now=BM(x);
	//	for(auto k:now)
	//		printf("%d\n",k);
	//	cerr<<now.size()<<endl;
		return solve(BM(x),x,K);
	}
}

int main(){
	int n;
	while(cin>>n){
		cout<<LS::gao(
{
0,
0,
24,
4,
240,
204,
1316,
2988,
6720,
26200,
50248,
174280,
436904,
1140888,
3436404,
8348748,
24631232,
64575924,
174658944,
488230244,
282739095,
583167773,
599201163,
111178790,
470158977,
118436480,
744170002,
418128853,
620410921,
282515603,
777785540,
59207630,
823529776,
886871858,
80677633,
874800287,
754269413,
659807497,
302870971,
307001715
},
		n-1)<<endl;
	}
	return 0;
}

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<vector>
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
using namespace std;
typedef int ll;
typedef long long int li;
const ll MAXN=262151,MOD=998244353,G=3,INVG=332748118;
ll x,res,cnt=1,limit=-1;
ll g[MAXN],g0[MAXN],g1[MAXN],g2[MAXN],f0[MAXN],rev[MAXN];
ll f1[MAXN],f2[MAXN],tmp1[MAXN],tmp2[MAXN],tmp3[MAXN],tmp4[MAXN];
ll p0[MAXN],p1[MAXN],tmpg0[MAXN],tmpg1[MAXN],tmpg2[MAXN];
inline ll read()
{
    register ll num=0,neg=1;
    register char ch=getchar();
    while(!isdigit(ch)&&ch!='-')
    {
        ch=getchar();
    }
    if(ch=='-')
    {
        neg=-1;
        ch=getchar();
    }
    while(isdigit(ch))
    {
        num=(num<<3)+(num<<1)+(ch-'0');
        ch=getchar();
    }
    return num*neg;
}
inline ll qpow(ll base,ll exponent)
{
    li res=1;
    while(exponent)
    {
        if(exponent&1)
        {
            res=(li)res*base%MOD;
        }
        base=(li)base*base%MOD,exponent>>=1;
    }
    return res;
}
inline void NTT(ll *cp,ll cnt,ll inv)
{
    ll cur=0,res=0,omg=0;
    for(register int i=0;i<cnt;i++)
    {
        if(i<rev[i])
        {
            swap(cp[i],cp[rev[i]]);
        }
    }
    for(register int i=2;i<=cnt;i<<=1)
    {
        cur=i>>1,res=qpow(inv==1?G:INVG,(MOD-1)/i);
        for(register ll *p=cp;p!=cp+cnt;p+=i)
        {
            omg=1;
            for(register int j=0;j<cur;j++)
            {
                ll t=(li)omg*p[j+cur]%MOD,t2=p[j];
                p[j+cur]=(t2-t+MOD)%MOD,p[j]=(t2+t)%MOD;
                omg=(li)omg*res%MOD;
            }
        }
    }
    if(inv==-1)
    {
        ll invl=qpow(cnt,MOD-2);
        for(register int i=0;i<=cnt;i++)
        {
            cp[i]=(li)cp[i]*invl%MOD;
        }
    }
}
inline void calc(ll l,ll r)
{
	ll cnt=1,limit=-1,mid=(l+r)>>1;
	while(cnt<=(r-l+1)<<1)
	{
		cnt<<=1,limit++;
	}
	for(register int i=0;i<cnt>>1;i++)
	{
		p0[i]=i+l<=mid?f0[i+l]:0,p1[i]=i+l<=mid?f1[i+l]:0;
		tmpg0[i]=g0[i],tmpg1[i]=g1[i],tmpg2[i]=g2[i];
		rev[i]=(rev[i>>1]>>1)|((i&1)<<limit);
	}
	for(register int i=cnt>>1;i<cnt;i++)
	{
		tmpg0[i]=tmpg1[i]=tmpg2[i]=p0[i]=p1[i]=0;
		rev[i]=(rev[i>>1]>>1)|((i&1)<<limit);
	}
	NTT(tmpg0,cnt,1),NTT(tmpg1,cnt,1),NTT(tmpg2,cnt,1);
	NTT(p0,cnt,1),NTT(p1,cnt,1);
	for(register int i=0;i<cnt;i++)
	{
		tmp1[i]=(li)tmpg0[i]*p0[i]%MOD,tmp2[i]=(li)tmpg1[i]*p0[i]%MOD;
		tmp3[i]=(li)tmpg1[i]*p1[i]%MOD,tmp4[i]=(li)tmpg2[i]*p1[i]%MOD;
		tmpg0[i]=tmpg1[i]=tmpg2[i]=p0[i]=p1[i]=0;
	}
	NTT(tmp1,cnt,-1),NTT(tmp2,cnt,-1),NTT(tmp3,cnt,-1),NTT(tmp4,cnt,-1);
	for(register int i=0;i<cnt>>1;i++)
	{
		if(i+l>=mid&&i+l<r)
		{
			f0[i+l+1]=(f0[i+l+1]+tmp1[i])%MOD;
			f1[i+l+1]=(f1[i+l+1]+tmp2[i])%MOD;
		}
		if(i+l>=mid-2&&i+l<r-2)
		{
			f0[i+l+3]=(f0[i+l+3]+tmp3[i])%MOD;
			f1[i+l+3]=(f1[i+l+3]+tmp4[i])%MOD;
		}
	}
}
inline void cdqFFT(ll l,ll r)
{
	if(l==r)
	{
		f0[l]=(f0[l]+g0[l])%MOD,f1[l]=(f1[l]+g1[l])%MOD;
		return;
	}
	ll mid=(l+r)>>1;
	cdqFFT(l,mid),calc(l,r),cdqFFT(mid+1,r);
}
inline void calc2(ll l,ll r)
{
	ll cnt=1,limit=-1,mid=(l+r)>>1;
	while(cnt<=(r-l+1)<<1)
	{
		cnt<<=1,limit++;
	}
	for(register int i=0;i<cnt>>1;i++)
	{
		p0[i]=i+l<=mid?f2[i+l]:0,tmpg2[i]=g2[i],tmp2[i]=0;
		rev[i]=(rev[i>>1]>>1)|((i&1)<<limit);
	}
	for(register int i=cnt>>1;i<cnt;i++)
	{
		p0[i]=tmpg2[i]=tmp2[i]=0;
		rev[i]=(rev[i>>1]>>1)|((i&1)<<limit);
	}
	NTT(p0,cnt,1),NTT(tmpg2,cnt,1);
	for(register int i=0;i<cnt;i++)
	{
		tmp2[i]=(li)p0[i]*tmpg2[i]%MOD,p0[i]=tmpg2[i]=0;
	}
	NTT(tmp2,cnt,-1);
	for(register int i=0;i<cnt>>1;i++)
	{
		if(i+l>=mid-2&&i+l<r-2)
		{
			f2[i+l+3]=(li)(f2[i+l+3]+tmp2[i])%MOD;
		}
	}
}
inline void cdqFFT2(ll l,ll r)
{
	if(l==r)
	{
		f2[l]=((f2[l]+g2[l])%MOD+(l>=1?tmp1[l-1]:0))%MOD;
		return;
	}
	ll mid=(l+r)>>1;
	cdqFFT2(l,mid),calc2(l,r),cdqFFT2(mid+1,r);
}
int main()
{
	x=read(),g[0]=g[2]=1;
	for(register int i=4;i<=x;i+=2)
	{
		g[i]=(g[i-4]+g[i-2])%MOD;
	}
	for(register int i=0;i<=x;i++)
	{
		g0[i]=(li)g[i]*i%MOD*i%MOD,g1[i]=(li)g[i]*(i+1)%MOD*(i+1)%MOD;
		g2[i]=(li)g[i]*(i+2)%MOD*(i+2)%MOD;
	}
	cdqFFT(0,x);
	while(cnt<=(x<<1))
	{
		cnt<<=1,limit++;
	}
	for(register int i=0;i<cnt;i++)
	{
		rev[i]=(rev[i>>1]>>1)|((i&1)<<limit);
		tmpg0[i]=i<cnt>>1?f1[i]:0,tmpg1[i]=i<cnt>>1?g1[i]:0,tmp1[i]=0;
	}
	NTT(tmpg0,cnt,1),NTT(tmpg1,cnt,1);
	for(register int i=0;i<cnt;i++)
	{
		tmp1[i]=(li)tmpg0[i]*tmpg1[i]%MOD,tmpg0[i]=tmpg1[i]=0;
	}
	NTT(tmp1,cnt,-1),cdqFFT2(0,x);
	res=(li)(g[x-1]+g[x-3])*(x-1)%MOD*(x-1)%MOD*x%MOD;
	for(register int i=2;i<x-1;i++)
	{
		res=(res+(li)g0[i-1]*f0[x-i-1]%MOD*i%MOD)%MOD;
		res=(res+(li)g1[i-2]*f1[x-i-2]%MOD*2%MOD*i%MOD)%MOD;
		if(i>2&&i<x-2)
		{
			res=(res+(li)g2[i-3]*f2[x-i-3]%MOD*i%MOD)%MOD;
		}
	}
	printf("%d\n",res);
}

#include<cstdio>
#include<algorithm>
using namespace std;const int N=1e5+10;const int S=40;
typedef unsigned long long ll;const ll mod=998244353;
struct poly
{
	int a[S+10];
	inline int& operator [](const int & x){return a[x];}
	poly(){for(int i=0;i<S;i++)a[i]=0;}
	friend poly operator * (poly a,poly b)
	{
		poly c;for(int i=0;i<S;i++)
			for(int j=0;j<S&&i+j<S;j++)c[i+j]+=a[i]*b[j];return c;
	}
	friend poly operator +(poly a,poly b){poly c;for(int i=0;i<S;i++)c[i]=a[i]+b[i];return c;}
	friend poly operator -(poly a,poly b){poly c;for(int i=0;i<S;i++)c[i]=a[i]-b[i];return c;}
	poly operator <<(const int& x){poly c;for(int i=S-1;i>=x;i--)c[i]=a[i-x];return c;}
}a,b,c,q,fz,fm,fz1,fm1;int n;
ll f0[N];ll c0[N];ll f1[N];ll c1[N];ll f2[N];ll c2[N];ll g[N];ll sqr[N];
inline void calc(poly& fz,poly& fm,ll* f,ll* c)
{
	for(int i=0;i<S;i++)f[i]=(mod+fz[i])%mod;
	for(int i=0;i<S;i++)c[i]=(mod-fm[i])%mod;(c[0]+=1)%=mod;
	for(int i=0;i<=n;i++)
		for(int j=1;j<S&&j<=i;j++)(f[i]+=f[i-j]*c[j])%=mod;
}
int main()
{
	a[8]=16;a[6]=12;a[4]=20;a[2]=4;b[8]=9;b[6]=2;b[4]=23;b[2]=6;b[0]=1;
	c[8]=4;c[6]=-4;c[4]=24;c[2]=4;c[0]=4;q[12]=-1;q[10]=-3;q[6]=+5;q[2]=-3;q[0]=+1;
	scanf("%d",&n);
	fz=((b*b)<<3)-a*((c<<3)-q);fm=((c<<3)-q)*((a<<1)-q)-((b*b)<<4);calc(fz,fm,f0,c0);
	fz=b*q;fm=((c<<3)-q)*((a<<1)-q)-((b*b)<<4);calc(fz,fm,f1,c1);
	fz1=c*fm+((b*fz)<<1);fm1=fm*(q-(c<<3));calc(fz1,fm1,f2,c2);
	g[0]=1;g[2]=1;for(int i=4;i<=n;i++)g[i]=(g[i-2]+g[i-4])%mod;
	for(int i=1;i<=n;i++)sqr[i]=(ll)i*i%mod;
	ll ans=(g[n-1]+g[n-3])*sqr[n-1]%mod*n%mod;
	for(int i=2;i<=n-2;i++)
	{
		ll ret=0;(ret+=g[i-1]*f0[n-i-1])%=mod;(ret+=g[i-2]*f1[n-i-2]*2)%=mod;
		if(3<=i&&i<=n-3)(ret+=g[i-3]*f2[n-i-3])%=mod;
		(ans+=ret*sqr[i-1]%mod*i)%=mod;
	}printf("%I64d",ans);
}

#include <bits/stdc++.h>
using namespace std;

const int P=998244353;

int power(int a, int b, int c = P) {
  int ans = 1;
  for(; b; b>>=1, a=(long long)a*a%c) {
    if(b&1) ans=(long long)ans*a%c;
  }
  return ans;
}

namespace FFT{
  const int M=1<<19;

  int IM;
  int a1[M], b1[M], p[M+1], rev[M];

  void NTT(int *B, int *A, int N, int D) {
    for(int j=0, d=__builtin_ctz(M/N); j<N; j++) A[rev[j]>>d]=B[j];
    for(int n=1, m=M/2*D; n<N; m/=2, n<<=1) {
      for(int i=0; i<N; i+=n<<1) {
        int *w=(D==1?p:p+M) , *a=A+i, *b=A+i+n;
        for(int j=0; j<n; j++, a++, b++, w+=m) {
          int x=1LL**w**b%P;
          *b=(*a+P-x)%P; *a=(*a+x)%P;
        }
      }
    }
  }

  void init() {
    int fac[100]={0}, n=0;
    for(int Q=P-1, q=2; Q>1; q++) if(Q%q==0) {
      while(Q%q==0) Q/=q; fac[n++]=q;
    }
    int G=2;
    while(1) {
      int flg=1;
      for(int i=0; i<n; i++) if(power(G, P/fac[i], P)==1) flg=0;
      if(flg) break;
      G++;
    }
    G=power(G, P/M, P);
    for(int i=0; i<=M; i++) p[i]=(i==0?1:(long long)p[i-1]*G%P);
    for(int i=0, j=1; j<M; j++) {
      for(int k=M>>1; (i^=k)<k; k>>=1);
      rev[j]=i;
    }
    IM=power(M, P-2, P);
  }

  void conv(int *a, int *b, int *c, int N) {
    if(N<=64) {
      static int temp[64];
      memset(temp, 0, sizeof(int)*N);
      for(int i=0; i<N; i++) {
        for(int j=0; j<N-i; j++) temp[i+j]=(temp[i+j]+1LL*a[i]*b[j])%P;
        for(int j=N-i; j<N; j++) temp[i+j-N]=(temp[i+j-N]+1LL*a[i]*b[j])%P;
      }
      memcpy(c, temp, sizeof(int)*N);
      return;
    }
    NTT(a, a1, N, 1);
    NTT(b, b1, N, 1);
    int R=IM*1LL*M/N%P;
    for(int i=0; i<N; i++) a1[i]=(long long)a1[i]*b1[i]%P*R%P;
    NTT(a1, c, N, -1);
  }

  void conv(int *a, int *b, int N) {
    if(N<=64) {
      static int temp[64];
      memset(temp, 0, sizeof(int)*N);
      for(int i=0; i<N; i++) {
        for(int j=0; j<N-i; j++) temp[i+j]=(temp[i+j]+1LL*a[i]*a[j])%P;
        for(int j=N-i; j<N; j++) temp[i+j-N]=(temp[i+j-N]+1LL*a[i]*a[j])%P;
      }
      memcpy(b, temp, sizeof(int)*N);
      return;
    }
    NTT(a, a1, N, 1);
    int R=power(N, P-2);
    for(int i=0; i<N; i++) a1[i]=(long long)a1[i]*a1[i]%P*R%P;
    NTT(a1, b, N, -1);
  }
};

using FFT::M;
using FFT::conv;

namespace Inverse{
  //AB=1Px^N, i.e.B=A^{-1}, A[0]!=0
  int A0[M], A[M];
  void inverse(int *a, int *B, int N) {
    memcpy(A, a, sizeof(int)*N);
    memset(B+1, 0, sizeof(int)*(N-1));
    B[0]=power(A[0], P-2);
    for(int n=2, h=1; n<=N; h<<=1, n<<=1) {
      conv(A, B, A0, n);
      for(int i=0; i<h; i++) A0[i]=0;
      conv(A0, B, A0, n);
      for(int i=h; i<n; i++) ((B[i]=P-A0[i]) ==P) && (B[i]=0);
    }
  }
};

using Inverse::inverse;

namespace Polynomial{
  int A7[M], A8[M];
  //C=A*B, deg(A)=n, deg(B) =m
  //A=A_n*x^n+...+A_0, B=B_m*x^m+...+B_0
  void multiply(int *A, int n, int *B, int m, int *C) {
    int N=1<<(32-__builtin_clz(n+m));
    memcpy(A7, A, sizeof(int)*(n+1));
    memset(A7+n+1, 0, sizeof(int)*(N-n-1));
    memcpy(A8, B, sizeof(int)*(m+1));
    memset(A8+m+1, 0, sizeof(int)*(N-m-1));
    conv(A7, A8, C, N);
  }
}

using Polynomial::multiply;

int g[M];
int S[M];
int H[M];
int G0[M];
int G1[M];
int G2[M];
int G3[M];
int F[M];
int F0[M];
int F1[M];
int F2[M];

int solve() {
  int n;
  scanf("%d", &n);
  g[0]=g[2]=1;
  for(int i=4; i<=n; i+=2) {
    g[i]=(g[i-2]+g[i-4])%P;
  }
  for(int i=0; i<=n+3; i++) {
    S[i]=(long long)i*i%P;
  }
  for(int i=0; i<=n; i++) {
    G0[i]=(long long)g[i]*S[i]%P;
    G1[i]=(long long)g[i]*S[i+1]%P;
    G2[i]=(long long)g[i]*S[i+2]%P;
  }
  multiply(G0, n, G2, n, H);
  multiply(G1, n, G1, n, G3);
  for(int i=0; i<=n; i++) {
    H[i]=(H[i]+P-G3[i])%P;
  }
  for(int i=0; i<=n; i++) {
    F0[i]=G0[i];
    if(i>2) F0[i]=F0[i]-H[i-3];
    if(F0[i]<0) F0[i]+=P;
    if(i==0) F[i]=1;
    if(i) F[i]=F[i]-G0[i-1];
    if(F[i]<0) F[i]+=P;
    if(i>2) F[i]=F[i]-G2[i-3];
    if(F[i]<0) F[i]+=P;
    if(i>3) F[i]=F[i]+H[i-4];
    if(F[i]>=P) F[i]-=P;
  }
  inverse(F, F, n+n);
  multiply(F, n, F0, n, F0);
  multiply(F, n, G1, n, F1);
  multiply(F1, n, G1, n, H);
  for(int i=0; i<=n; i++) {
    if(i<3) G3[i]=i==0;
    else G3[i]=(P-G2[i-3])%P;
  }
  inverse(G3, G3, n+n);
  for(int i=0; i<=n; i++) {
    F2[i]=G2[i];
    if(i) {
      F2[i]=(F2[i]+H[i-1])%P;
    }
  }
  multiply(F2, n, G3, n, F2);
  long long ans = (long long)(n-1)*(n-1)%P*(g[n-1]+g[n-3])%P*n%P;
  for(int i=2; i<=n-2; i++) {
    ans += (long long)g[i-1]*S[i-1]%P*F0[n-i-1]%P*i%P;
    ans += (long long)g[i-2]*S[i-1]%P*F1[n-i-2]%P*2*i%P;
    if(i>=3 && i<=n-3) {
      ans += (long long)g[i-3]*S[i-1]%P*F2[n-i-3]%P*i%P;
    }
  }
  ans = (ans%P+P)%P;
  return ans;
}

int main() {
#ifndef ONLINE_JUDGE
  freopen("E.in", "r", stdin);
  freopen("out.out", "w", stdout);
#endif
  FFT::init();
  cout<<solve()<<endl;
  return 0;
}

#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define per(i, a, b) for (int i = a; i >= b; i--)
using namespace std;

typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef long long ll;

template <typename _T>
inline void read(_T &f) {
    f = 0; _T fu = 1; char c = getchar();
    while (c < '0' || c > '9') { if (c == '-') { fu = -1; } c = getchar(); }
    while (c >= '0' && c <= '9') { f = (f << 3) + (f << 1) + (c & 15); c = getchar(); }
    f *= fu;
}

template <typename T>
void print(T x) {
    if (x < 0) putchar('-'), x = -x;
    if (x < 10) putchar(x + 48);
    else print(x / 10), putchar(x % 10 + 48);
}

template <typename T>
void print(T x, char t) {
    print(x); putchar(t);
}

const int N = 50005, md = 998244353;

inline int add(int x, int y) {
    x += y;
    if (x >= md) x -= md;
    return x;
}

inline int sub(int x, int y) {
    x -= y;
    if (x < 0) x += md;
    return x;
}

inline int mul(int x, int y) { return 1ll * x * y % md; }

inline int fpow(int x, int y) {
    int ans = 1;
    while (y) {
        if (y & 1) ans = mul(ans, x);
        y >>= 1; x = mul(x, x);
    }
    return ans;
}

namespace Poly {
    vector <int> roots, rev;

    void getRevRoot(int base) {
        int n = 1 << base;
        if ((int)roots.size() == n) return;
        roots.resize(n); rev.resize(n);
        for (int i = 1; i < n; i++) rev[i] = (rev[i >> 1] >> 1) | ((i & 1) << (base - 1));
        for (int mid = 1; mid < n; mid <<= 1) {
            int wn = fpow(3, (md - 1) / (mid << 1));
            roots[mid] = 1;
            for (int i = 1; i < mid; i++) roots[i + mid] = mul(roots[i + mid - 1], wn);
        }
    }

    void ntt(vector <int> &a, int base) {
        int n = 1 << base;
        for (int i = 1; i < n; i++) {
            if (i < rev[i]) {
                swap(a[i], a[rev[i]]);
            }
        }
        for (int mid = 1; mid < n; mid <<= 1) {
            for (int i = 0; i < n; i += (mid << 1)) {
                for (int j = 0; j < mid; j++) {
                    int x = a[i + j], y = mul(a[i + j + mid], roots[mid + j]);
                    a[i + j] = add(x, y); a[i + j + mid] = sub(x, y);
                }
            }
        }
    }

    vector <int> operator * (vector <int> a, vector <int> b) {
        int n = (int)a.size() + (int)b.size() - 1, base = 0;
        while ((1 << base) < n) ++base;
        a.resize(1 << base); b.resize(1 << base);
        getRevRoot(base); ntt(a, base); ntt(b, base);
        for (int i = 0; i < (1 << base); i++) a[i] = mul(a[i], b[i]);
        reverse(a.begin() + 1, a.end()); ntt(a, base); a.resize(n);
        int inv = fpow(1 << base, md - 2);
        for (int i = 0; i < n; i++) a[i] = mul(a[i], inv);
        return a;
    }
}

using Poly::operator *;

vector <int> f0, f1, f2, g0, g1, g2, tmp;
int F0[N], F1[N], F2[N], G0[N], G1[N], G2[N], g[N];
int n, ans;

void cdq(int l, int r) {
    if (l == r) {
        F0[l] = add(F0[l], G0[l]);
        F1[l] = add(F1[l], G1[l]);
        F2[l] = add(F2[l], G2[l]);
        return;
    }
    int mid = (l + r) >> 1;
    cdq(l, mid);
    f0.resize(mid - l + 1); f1.resize(mid - l + 1); f2.resize(mid - l + 1);
    for (int i = l; i <= mid; i++) {
        f0[i - l] = F0[i];
        f1[i - l] = F1[i];
        f2[i - l] = F2[i];
    }
    g0.resize(r - l + 1); g1.resize(r - l + 1); g2.resize(r - l + 1);
    for (int i = 0; i <= r - l; i++) {
        g0[i] = G0[i];
        g1[i] = G1[i];
        g2[i] = G2[i];
    }
    tmp = f0 * g0;
    for (int i = mid - l + 1; i <= r - l; i++) F0[i + l] = add(F0[i + l], tmp[i]);
    tmp = f1 * g0;
    for (int i = mid - l + 1; i <= r - l; i++) F1[i + l] = add(F1[i + l], tmp[i]);
    tmp = f1 * g1;
    for (int i = mid - l + 1; i <= r - l; i++) F0[i + l] = add(F0[i + l], tmp[i]);
    for (int i = mid - l + 1; i <= r - l; i++) F2[i + l] = add(F2[i + l], tmp[i]);
    tmp = f2 * g1;
    for (int i = mid - l + 1; i <= r - l; i++) F1[i + l] = add(F1[i + l], tmp[i]);
    tmp = f2 * g2;
    for (int i = mid - l + 1; i <= r - l; i++) F2[i + l] = add(F2[i + l], tmp[i]);
    cdq(mid + 1, r);
}

int main() {
    read(n);
    g[0] = 1;
    for (int i = 2; i <= n; i += 2) {
        g[i] = g[i - 2];
        if (i >= 4) g[i] = add(g[i], g[i - 4]);
    }
    for (int i = 1; i <= n; i++) G0[i] = mul(g[i - 1], mul(i - 1, i - 1));
    for (int i = 2; i <= n; i++) G1[i] = mul(g[i - 2], mul(i - 1, i - 1));
    for (int i = 3; i <= n; i++) G2[i] = mul(g[i - 3], mul(i - 1, i - 1));
    cdq(1, n);
    ans = mul(n, add(G0[n], G2[n]));
    for (int i = 0; i <= n; i++) {
        int res = 0;
        res = add(res, mul(F0[i], G0[n - i]));
        res = add(res, mul(2, mul(F1[i], G1[n - i])));
        res = add(res, mul(F2[i], G2[n - i]));
        ans = add(ans, mul(res, n - i));
    }
    print(ans, '\n');
    return 0;
}

//CLOCKS_PER_SEC
using namespace std;
#include<bits/stdc++.h>
#define sqr(x) 1ll*(x)*(x)
//#define sort stable_sort
#define ll long long
#define mk make_pair
#define pb push_back
#define in insert
#define mtr(x,y,z) mk(mk(x,y),z)
#define fi first
#define se second
#define lch(x) ((x)<<1)
#define rch(x) (((x)<<1)|1)
#define all(x) (x).begin(),(x).end()
#define titose CLOCKS_PER_SEC
#define fpi(x) freopen(x,"r",stdin);
#define fpo(x) freopen(x,"w",stdout);
#define fprio fpi("in.txt");fpo("out.txt");
#define fast ios_base::sync_with_stdio(false);
inline void read(int &x){int v=0,f=1;char c=getchar();while (!isdigit(c)&&c!='-') c=getchar();if (c=='-') f=-1; else v=(c&15);while (isdigit(c=getchar())) v=(v<<1)+(v<<3)+(c&15);x=v*f;}
inline void read(ll &x){ll v=0ll,f=1ll;char c=getchar();while (!isdigit(c)&&c!='-') c=getchar();if (c=='-') f=-1; else v=(c&15);while (isdigit(c=getchar())) v=(v<<1)+(v<<3)+(c&15);x=v*f;}
inline void readc(char &x){char c;while (((c=getchar())==' ')||c=='\n');x=c;}
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define si set<int>
#define sl set<ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define msi map<string,int>
#define msl map<string,ll>
#define piii pair<int,pii >
#define piipi pair<pii,int>
#define plll pair<ll,pll >
#define pllpl pair<pll,ll>
#define pqi priority_queue<int>
#define pql priority_queue<ll>
#define npqi priority_queue<int,vector<int>,greater<int> >
#define npql priority_queue<ll,vector<ll>,greater<ll> >
#define forup(i,a,b) for ((i)=(a);(i)<=(b);(i)++)
#define fordo(i,a,b) for ((i)=(a);(i)>=(b);(i)--)
#define rep(i,x) forup ((i),1,(x))
#define repd(i,x) fordo ((i),(x),1)
#define rep0(i,x) forup ((i),0,(x)-1)
#define rep0d(i,x) fordo ((i),((int)(x))-1,0)
#define itr iterator
#define fe(itcalc,c) for(__typeof((c).begin()) itcalc=(c).begin();itcalc!=(c).end();itcalc++)
#define NO {cout<<"NO";return 0;}
#define YES {cout<<"YES";return 0;}
#define y0 y000000000000000000000000000
#define y1 y111111111111111111111111111
#define j0 j000000000000000000000000000
#define j1 j111111111111111111111111111
#define cl0(a) memset((a),(0),(sizeof((a))))
#define clz(a) memset((a),(0x16),(sizeof((a))))
#define clf(a) memset((a),(-(0x16)),(sizeof((a))))
#define inf 0x3bbbbbbb
#define lnf 0x2bbbbbbbbbbbbbbbll
//#define sqrt divi
#define p2(i) (1ll<<(i))
#define readi read
#define readll read
/*************************************************/
const int mod=998244353,maxn=131072;
int n,m,i,j,g[50005],g0[50005],g1[50005],g2[50005],f0[50005],f1[50005],f2[50005],w[maxn+5],tmp[maxn+5],ans,inv[maxn+5],rev[maxn+5];
int d[maxn+5],e[maxn+5];
int pw(int x,int y)
{
	int z=1;
	while(y){
		if(y&1)z=1ll*z*x%mod;
		x=1ll*x*x%mod;y/=2;
	}
	return z;
}
void init()
{
	int i;
	inv[1]=w[0]=1;w[1]=pw(3,(mod-1)/maxn);
	forup(i,2,maxn){
		inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;
		w[i]=1ll*w[i-1]*w[1]%mod;
	}
}
int getrev(int x)
{
	int len=1;while(len<=x)len<<=1;
	int i;rep0(i,len) rev[i]=((rev[i>>1]>>1)|((i&1)*(len>>1)));
	return len;
}
void ntt(int *a,int len,int op)
{
	int i,j,k;
	rep0(i,len)if(rev[i]<i) swap(a[i],a[rev[i]]);
	for(i=1;i<len;i<<=1){
		int ys=maxn/2/i;
		for(j=0;j<len;j+=i+i){
			int t=(op==1?0:maxn);
			rep0(k,i){
				int x=a[j+k],y=1ll*a[j+k+i]*w[t]%mod;
				a[j+k]=(x+y)%mod;a[j+k+i]=(x-y+mod)%mod;
				t+=op*ys;
			}
		}
	}
	if(op==-1)rep0(i,len) a[i]=1ll*a[i]*inv[len]%mod;
}
void poly_mul(int *a,int la,int *b,int lb,int *c,int lc)
{
	int len=getrev(la+lb-1);
	rep0(i,len){
		d[i]=(i<la?a[i]:0);
		e[i]=(i<lb?b[i]:0);
	}
	ntt(d,len,1);
	ntt(e,len,1);
	rep0(i,len) d[i]=1ll*d[i]*e[i]%mod;
	ntt(d,len,-1);
	rep0(i,lc) c[i]=d[i];
}
void solve(int l,int r)
{
	if(l==r){
		f0[l]=(f0[l]+g0[l])%mod;
		f1[l]=(f1[l]+g1[l])%mod;
		f2[l]=(f2[l]+g2[l])%mod;
		return;
	}
	int mid=(l+r)/2,i;
	solve(l,mid);
	poly_mul(f0+l,mid-l+1,g0,r-l+1,tmp+l,r-l+1);
	forup(i,mid+1,r) f0[i]=(f0[i]+tmp[i])%mod;
	poly_mul(f0+l,mid-l+1,g1,r-l+1,tmp+l,r-l+1);
	forup(i,mid+1,r) f1[i]=(f1[i]+tmp[i])%mod;
	poly_mul(f1+l,mid-l+1,g1,r-l+1,tmp+l,r-l+1);
	forup(i,mid+1,r) f0[i]=(f0[i]+tmp[i])%mod;
	forup(i,mid+1,r) f2[i]=(f2[i]+tmp[i])%mod;
	poly_mul(f1+l,mid-l+1,g2,r-l+1,tmp+l,r-l+1);
	forup(i,mid+1,r) f1[i]=(f1[i]+tmp[i])%mod;
	poly_mul(f2+l,mid-l+1,g2,r-l+1,tmp+l,r-l+1);
	forup(i,mid+1,r) f2[i]=(f2[i]+tmp[i])%mod;
	solve(mid+1,r);
}
int main()
{
	init();
	read(n);
	g[0]=g[2]=1;
	for(i=4;i<=n;i+=2){
		g[i]=(g[i-2]+g[i-4])%mod;
	}
	forup(i,1,n){
		g0[i]=1ll*(i-1)*(i-1)%mod*g[i-1]%mod;
	}
	forup(i,2,n){
		g1[i]=1ll*(i-1)*(i-1)%mod*g[i-2]%mod;
	}
	forup(i,3,n){
		g2[i]=1ll*(i-1)*(i-1)%mod*g[i-3]%mod;
	}
	solve(1,n);
	ans=1ll*n*(g0[n]+g2[n])%mod;
	for(i=2;i<=n-2;i++){
		ans=(ans+(1ll*g0[i]*f0[n-i]+2ll*g1[i]*f1[n-i]+1ll*g2[i]*f2[n-i])%mod*i)%mod;
	}
	cout<<ans<<endl;
	return 0;
}

//加油吧
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod=998244353,N=200200,G=3,Gi=332748118;
ll power(ll base,ll b){
	ll ret=1;
	while(b){
		if(b&1)ret=ret*base%mod;
		base=base*base%mod;
		b>>=1;
	}
	return ret;
}
int limit,len,last=-1,pos[N];
ll G0[N],G1[N],G2[N],g[N],F0[N],F1[N],F2[N];
//F0是两端都没有距离为2的点
//F1是一端有距离为2的点  (答案统计时有两种方案数相同的情况)
//F2是两端都有距离为2的点
//inline void getlen(int n){
//	limit=1,len=0;
//	while(limit<n)limit<<=1,++len;
//	if(last==limit)return;
//	last=limit;
//	for(int i=0;i<limit;++i)
//		pos[i]=(pos[i>>1]>>1)|((i&1)<<(len-1));
//}
//inline void ntt(ll *a,int n,int type){
//	for(int i=0;i<limit;++i)
//		if(i<pos[i])swap(a[i],a[pos[i]]);
//	for(int mid=1;mid<limit;mid<<=1){
//		ll wn=power((type==1?G:Gi),(mod-1)/(mid<<1));
//		for(int j=0;j<limit;j+=(mid<<=1)){
//			ll w=1;
//			for(int k=0;k<mid;++k,w=w*wn%mod){
//				ll x=a[j+k],y=a[j+mid+k]*w%mod;
//				a[j+k]=(x+y)%mod;
//				a[j+mid+k]=(x-y+mod)%mod;
//			}
//		}
//	}
//	if(type==-1){
//		ll inv=power(limit,mod-2);
//		for(int i=0;i<n;++i)a[i]=a[i]*inv%mod;
//		for(int i=n;i<limit;++i)a[i]=0;
//	}
//}
ll w[N];
void getlen(int n){
	limit=1,len=0;
	while(limit<n)limit<<=1,++len;
	w[0]=1;
	ll gg=power(G,(mod-1)/limit);
	for(int i=1;i<limit;++i){
		pos[i]=(pos[i>>1]>>1)|((i&1)<<(len-1));
		w[i]=w[i-1]*gg%mod;
	}
}
void ntt(ll *a,int n,int type){
	for(int i=0;i<limit;++i)
		if(i<pos[i])swap(a[i],a[pos[i]]);
	for(int mid=1;mid<limit;mid<<=1)
		for(int j=0,r=mid<<1;j<limit;j+=r)
			for(int k=0;k<mid;++k){
				ll x=a[j+k],y=w[limit/r*k]*a[j+mid+k]%mod;
				a[j+k]=(x+y)%mod;
				a[j+mid+k]=(x-y+mod)%mod;
			}
	if(type==-1){
		reverse(a+1,a+limit);
		ll inv=power(limit,mod-2);
		for(int i=0;i<limit;++i)a[i]=inv*a[i]%mod;
	}
}
ll f[N],h[N],tmp[N];
void calc(ll *a,int n,ll *b,int m,ll *c,int nm=-1){
	if(nm==-1)nm=n+m-1;
	getlen(nm);
	for(int i=0;i<n;++i)f[i]=a[i];
	for(int i=n;i<limit;++i)f[i]=0;
	for(int i=0;i<m;++i)h[i]=b[i];
	for(int i=m;i<limit;++i)h[i]=0;
	ntt(f,nm,1),ntt(h,nm,1);
	for(int i=0;i<limit;++i)f[i]=f[i]*h[i]%mod;
	ntt(f,nm,-1);
	for(int i=0;i<nm;++i)c[i]=f[i];
}
void CDQ(int l,int r){
	if(l==r){
		F0[l]=(F0[l]+G0[l])%mod;
		F1[l]=(F1[l]+G1[l])%mod;
		F2[l]=(F2[l]+G2[l])%mod;
		return;
	}
	int mid=(l+r)>>1;
	CDQ(l,mid);
	calc(F0+l,mid-l+1,G0,r-l+1,tmp+l,r-l+1);
	for(int i=mid+1;i<=r;++i)F0[i]=(F0[i]+tmp[i])%mod;
	calc(F0+l,mid-l+1,G1,r-l+1,tmp+l,r-l+1);
	for(int i=mid+1;i<=r;++i)F1[i]=(F1[i]+tmp[i])%mod;
	calc(F1+l,mid-l+1,G1,r-l+1,tmp+l,r-l+1);
	for(int i=mid+1;i<=r;++i)F0[i]=(F0[i]+tmp[i])%mod;
	for(int i=mid+1;i<=r;++i)F2[i]=(F2[i]+tmp[i])%mod;
	calc(F1+l,mid-l+1,G2,r-l+1,tmp+l,r-l+1);
	for(int i=mid+1;i<=r;++i)F1[i]=(F1[i]+tmp[i])%mod;
	calc(F2+l,mid-l+1,G2,r-l+1,tmp+l,r-l+1);
	for(int i=mid+1;i<=r;++i)F2[i]=(F2[i]+tmp[i])%mod;
	//注意是左边对右边的贡献
	CDQ(mid+1,r);
}
int n;
int main(){
//	freopen("y.in","r",stdin);
	scanf("%d",&n);
	g[0]=g[2]=1;
	for(int i=4;i<=n;++i)g[i]=(g[i-2]+g[i-4])%mod;
	for(int i=1;i<=n;++i)G0[i]=1LL*(i-1)*(i-1)%mod*g[i-1]%mod;
	for(int i=2;i<=n;++i)G1[i]=1LL*(i-1)*(i-1)%mod*g[i-2]%mod;
	for(int i=3;i<=n;++i)G2[i]=1LL*(i-1)*(i-1)%mod*g[i-3]%mod;
	CDQ(1,n);
	ll Ans=1LL*n*(G0[n]+G2[n])%mod;//可以旋转n次
	for(int i=2;i<=n-2;++i){
		Ans=(Ans+(G0[i]*F0[n-i]%mod+2LL*G1[i]*F1[n-i]%mod+G2[i]*F2[n-i]%mod)*(ll)i%mod)%mod;//把第一个相对的点对旋转到1-n+1处
	}
	printf("%lld\n",(Ans%mod+mod)%mod);
	return 0;
}

#pragma GCC optimize (2)
#pragma GCC optimize ("unroll-loops")
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<vector>
#define ll long long
#define reg register
#define p 998244353
using namespace std;

struct matrix{
    int a[16][16];
    inline matrix(){ memset(a,0,sizeof(a)); }

    inline matrix operator * (const matrix& b) const{
        matrix res = matrix();
        for(reg int i=0;i!=16;++i)
        for(reg int j=0;j!=16;++j)
        for(reg int k=0;k!=16;++k)
            res.a[i][j] = (res.a[i][j]+(ll)a[i][k]*b.a[k][j])%p;
        return res;
    }
}A;

inline matrix power(matrix a,int t){
    matrix res = matrix();
    for(reg int i=0;i!=16;++i) res.a[i][i] = 1;
    while(1){
        if(t&1) res = res*a;
        t >>= 1;
        if(t==0) break;
        a = a*a;
    }
    return res;
}

const int a[16] = {0,0,0,24,4,240,204,1316,2988,6720,26200,50248,174280,436904,1140888,3436404};
const int f[17] = {-1,0,4,8,-1,16,-10,4,-12,-48,26,-44,15,-16,-4,-4,-1};
int n,ans;

int main(){
    scanf("%d",&n);
    if(n<=15){
        printf("%d",a[n]);
        return 0;
    }
    for(reg int i=0;i!=16;++i) A.a[i][0] = f[i+1];
    for(reg int i=1;i!=16;++i) A.a[i-1][i] = 1;
    A = power(A,n-15);
    for(reg int i=0;i!=16;++i) ans = (ans+(ll)a[15-i]*A.a[i][0])%p;
    printf("%d",(ans%p+p)%p);
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=3e5+10,p=119<<23|1;
int inc(int x,int y){x+=y;return x>=p?x-p:x;}
int dec(int x,int y){x-=y;return x<0?x+p:x;}
int mul(int x,int y){return (ll)x*y%p;}
int power(int x,int y){
    int ans=1;
    for (;y;y>>=1,x=mul(x,x))
        if (y&1) ans=mul(ans,x);
    return ans;
}
int w[N],iw[N];
void init(int n){
    w[0]=1;w[1]=power(3,(p-1)/n);
    for (int i=2;i<=n;i++) w[i]=mul(w[i-1],w[1]);
    for (int i=0;i<=n;i++) iw[i]=w[n-i];
}
void fft(int n,int *a,int *w){
    for (int i=0,j=0;i<n;i++){
        if (i<j) swap(a[i],a[j]);
        for (int k=n>>1;(j^=k)<k;k>>=1);
    }
    for (int i=2;i<=n;i<<=1){
        int m=i>>1,step=n/i;
        for (int j=0;j<n;j+=i)
        for (int k=0,pos=0;k<m;k++,pos+=step){
            int t=mul(a[j+k+m],w[pos]);
            a[j+k+m]=dec(a[j+k],t);
            a[j+k]=inc(a[j+k],t);
        }
    }
    if (w==iw){
        int del=power(n,p-2);
        for (int i=0;i<n;i++) a[i]=mul(a[i],del);
    }
}
void getinv(int n,int *a,int *b){
    if (n==1) return void(b[0]=power(a[0],p-2));
    getinv((n+1)>>1,a,b);
    static int tmp[N];
    int size=1;
    while (size<n+n) size<<=1;
    for (int i=0;i<n;i++) tmp[i]=a[i];
    for (int i=n;i<size;i++) tmp[i]=0;
    init(size);
    fft(size,tmp,w);fft(size,b,w);
    for (int i=0;i<size;i++) b[i]=mul(b[i],dec(2,mul(b[i],tmp[i])));
    fft(size,b,iw);
    for (int i=n;i<size;i++) b[i]=0;
}
int sqr(int x){return mul(x,x);}
int n,f0[N],f1[N],f2[N],g[N],g0[N],g1[N],g2[N],inv[N],frac[N];
int A[N],B[N],C[N],D[N],E[N],F[N];
int main()
{
    scanf("%d",&n);
    g[0]=g[2]=1;
    for (int i=4;i<=n;i+=2) g[i]=inc(g[i-2],g[i-4]);
    for (int i=0;i<=n;i++){
        g0[i]=mul(g[i],sqr(i));
        g1[i]=mul(g[i],sqr(i+1));
        g2[i]=mul(g[i],sqr(i+2));
    }
    int size=1;
    while (size<4*n) size<<=1;
    init(size);
    for (int i=0;i<=n;i++){
        A[i]=(i<3?0:g2[i-3]);
        B[i]=(i<1?0:g0[i-1]);
        C[i]=g1[i];
        E[i]=g0[i];
    }
    A[0]=dec(A[0],1);
    B[0]=dec(B[0],1);
    fft(size,C,w);
    for (int i=0;i<size;i++) D[i]=sqr(C[i]);
    fft(size,D,iw);
    for (int i=n+1;i<size;i++) D[i]=0;
    for (int i=4;i<=n;i++) F[i]=D[i-4];
    for (int i=n;i>=0;i--) D[i]=(i>=3?D[i-3]:0);
    fft(size,A,w);fft(size,B,w);fft(size,F,w);
    for (int i=0;i<size;i++) frac[i]=dec(mul(A[i],B[i]),F[i]);
    fft(size,frac,iw);
    for (int i=n+1;i<size;i++) frac[i]=0;
    getinv(n+1,frac,inv);
    init(size);
    fft(size,inv,w);
    for (int i=0;i<size;i++) f1[i]=mul(inv[i],C[i]);
    fft(size,f1,iw);
    fft(size,E,w);fft(size,D,w);
    for (int i=0;i<size;i++) f0[i]=mul(inv[i],dec(D[i],mul(E[i],A[i])));
    fft(size,f0,iw);
    for (int i=n+1;i<size;i++) f0[i]=f1[i]=0;
    for (int i=0;i<size;i++) A[i]=B[i]=C[i]=inv[i]=0;
    for (int i=0;i<=n;i++){
        A[i]=g2[i];
        B[i]=(i<1?0:g1[i-1]);
        C[i]=(i<3?0:dec(0,g2[i-3]));
    }
    C[0]=inc(C[0],1);
    getinv(n+1,C,inv);
    init(size);
    fft(size,A,w);fft(size,B,w);fft(size,f1,w);fft(size,inv,w);
    for (int i=0;i<size;i++) f2[i]=mul(inc(A[i],mul(B[i],f1[i])),inv[i]);
    fft(size,f1,iw);fft(size,f2,iw);
    int ans=mul(mul(inc(g[n-1],g[n-3]),sqr(n-1)),n);
    for (int i=2;i<=n-2;i++){
        ans=inc(ans,mul(mul(g[i-1],sqr(i-1)),mul(f0[n-i-1],i)));
        ans=inc(ans,mul(mul(g[i-2],sqr(i-1)),mul(f1[n-i-2],i*2)));
        if (i>=3&&i<=n-3)
        ans=inc(ans,mul(mul(g[i-3],sqr(i-1)),mul(f2[n-i-3],i)));
    }
    printf("%d\n",ans);
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = 262145;
const int M = 20;
const int G = 3;
const int mod = 998244353;

int fft_n, fft_l, fft_i[M], fft_w[M], fft_r[N];

int add(int x, int y) {
  x += y;
  if (x >= mod) {
    x -= mod;
  }
  return x;
}

int sub(int x, int y) {
  x -= y;
  if (x < 0) {
    x += mod;
  }
  return x;
}

int mul(int x, int y) {
  return (ll)x * y % mod;
}

int power(int x, int y) {
  int result = 1;
  for (; y; y >>= 1, x = mul(x, x)) {
    if (y & 1) {
      result = mul(result, x);
    }
  }
  return result;
}

void init(int n) {
  for (fft_n = 1, fft_l = 0; fft_n < n; fft_n <<= 1, ++fft_l);
  fft_w[0] = power(G, mod - 1 >> fft_l);
  for (int i = 1; i < fft_l; ++i) {
    fft_w[i] = mul(fft_w[i - 1], fft_w[i - 1]);
  }
  fft_i[0] = power(fft_w[0], mod - 2);
  for (int i = 1; i < fft_l; ++i) {
    fft_i[i] = mul(fft_i[i - 1], fft_i[i - 1]);
  }
  for (int i = 0; i < fft_n; ++i) {
    fft_r[i] = (fft_r[i >> 1] >> 1) | ((i & 1) << fft_l - 1);
  }
}

void dft(int *x, int *fft_w, bool div) {
  for (int i = 0; i < fft_n; ++i) {
    if (i < fft_r[i]) {
      swap(x[i], x[fft_r[i]]);
    }
  }
  for (int i = 1, l = fft_l - 1; i < fft_n; i <<= 1, --l) {
    for (int j = 0; j < fft_n; j += i << 1) {
      for (int k = 0, w = 1; k < i; ++k, w = mul(w, fft_w[l])) {
        int u = x[j + k], v = mul(x[j + k + i], w);
        x[j + k] = add(u, v);
        x[j + k + i] = sub(u, v);
      }
    }
  }
  if (div) {
    int inv = power(fft_n, mod - 2);
    for (int i = 0; i < fft_n; ++i) {
      x[i] = mul(x[i], inv);
    }
  }
}

int n, answer, f[N], g[N], h[N], dp[N], value[N], dft_f[N], dft_g[N], dft_h[N], dft_zero[N], dft_one[N], dft_two[N], result[N];

void solve(int l, int r) {
  if (r - l <= 128) {
    for (int i = l; i <= r; ++i) {
      f[i] = add(f[i], mul(dp[i], value[i]));
      g[i] = add(g[i], mul(dp[i], value[i + 1]));
      h[i] = add(h[i], mul(dp[i], value[i + 2]));
      for (int j = l; j <= i - 1; ++j) {
        f[i] = add(f[i], mul(f[j], mul(dp[i - j - 1], value[i - j - 1])));
        g[i] = add(g[i], mul(f[j], mul(dp[i - j - 1], value[i - j - 0])));
        h[i] = add(h[i], mul(g[j], mul(dp[i - j - 1], value[i - j - 0])));
      }
      for (int j = l; j <= i - 3; ++j) {
        f[i] = add(f[i], mul(g[j], mul(dp[i - j - 3], value[i - j - 2])));
        g[i] = add(g[i], mul(g[j], mul(dp[i - j - 3], value[i - j - 1])));
        h[i] = add(h[i], mul(h[j], mul(dp[i - j - 3], value[i - j - 1])));
      }
    }
    return;
  }
  int mid = l + r >> 1;
  solve(l, mid);
  init(mid + r - (l << 1));
  for (int i = 0; i < fft_n; ++i) {
    dft_f[i] = dft_g[i] = dft_h[i] = dft_zero[i] = dft_one[i] = dft_two[i] = 0;
  }
  for (int i = l; i <= mid; ++i) {
    dft_f[i - l] = f[i];
    dft_g[i - l] = g[i];
    dft_h[i - l] = h[i];
  }
  for (int i = 0; i < r - l; ++i) {
    dft_zero[i] = mul(dp[i], value[i]);
    dft_one[i] = mul(dp[i], value[i + 1]);
    dft_two[i] = mul(dp[i], value[i + 2]);
  }
  dft(dft_f, fft_w, false);
  dft(dft_g, fft_w, false);
  dft(dft_h, fft_w, false);
  dft(dft_zero, fft_w, false);
  dft(dft_one, fft_w, false);
  dft(dft_two, fft_w, false);
  for (int i = 0; i < fft_n; ++i) {
    result[i] = mul(dft_f[i], dft_zero[i]);
  }
  dft(result, fft_i, true);
  for (int i = mid + 1; i <= r; ++i) {
    f[i] = add(f[i], result[i - l - 1]);
  }
  for (int i = 0; i < fft_n; ++i) {
    result[i] = mul(dft_f[i], dft_one[i]);
  }
  dft(result, fft_i, true);
  for (int i = mid + 1; i <= r; ++i) {
    g[i] = add(g[i], result[i - l - 1]);
  }
  for (int i = 0; i < fft_n; ++i) {
    result[i] = mul(dft_g[i], dft_one[i]);
  }
  dft(result, fft_i, true);
  for (int i = mid + 1; i <= r; ++i) {
    h[i] = add(h[i], result[i - l - 1]);
  }
  for (int i = 0; i < fft_n; ++i) {
    result[i] = mul(dft_g[i], dft_one[i]);
  }
  dft(result, fft_i, true);
  for (int i = max(mid + 1, l + 3); i <= r; ++i) {
    f[i] = add(f[i], result[i - l - 3]);
  }
  for (int i = 0; i < fft_n; ++i) {
    result[i] = mul(dft_g[i], dft_two[i]);
  }
  dft(result, fft_i, true);
  for (int i = max(mid + 1, l + 3); i <= r; ++i) {
    g[i] = add(g[i], result[i - l - 3]);
  }
  for (int i = 0; i < fft_n; ++i) {
    result[i] = mul(dft_h[i], dft_two[i]);
  }
  dft(result, fft_i, true);
  for (int i = max(mid + 1, l + 3); i <= r; ++i) {
    h[i] = add(h[i], result[i - l - 3]);
  }
  solve(mid + 1, r);
}

int main() {
#ifdef wxh010910
  freopen("input.txt", "r", stdin);
#endif
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    value[i] = mul(i, i);
  }
  dp[0] = 1;
  for (int i = 1; i <= n; ++i) {
    if (i >= 2) {
      dp[i] = add(dp[i], dp[i - 2]);
    }
    if (i >= 4) {
      dp[i] = add(dp[i], dp[i - 4]);
    }
  }
  solve(0, n);
  answer = mul(mul(add(dp[n - 1], dp[n - 3]), value[n - 1]), n);
  for (int i = 2; i <= n - 2; ++i) {
    int coef = 0;
    coef = add(coef, mul(mul(dp[i - 1], f[n - i - 1]), value[i - 1]));
    coef = add(coef, mul(mul(dp[i - 2], g[n - i - 2]), value[i - 1]));
    coef = add(coef, mul(mul(dp[i - 2], g[n - i - 2]), value[i - 1]));
    if (i >= 3 && i <= n - 3) {
      coef = add(coef, mul(mul(dp[i - 3], h[n - i - 3]), value[i - 1]));
    }
    answer = add(answer, mul(coef, i));
  }
  printf("%d\n", answer);
  return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef double db;
#define fir first
#define sec second
#define rep(i,a,b) for (int i = (a) ; i <= (b) ; ++ i)
#define rrp(i,a,b) for (int i = (a) ; i >= (b) ; -- i)
#define gc() getchar()
template <typename tp>
inline void read(tp& x) {
  x = 0; char tmp; bool key = 0;
  for (tmp = gc() ; !isdigit(tmp) ; tmp = gc())
    key = (tmp == '-');
  for ( ; isdigit(tmp) ; tmp = gc())
    x = (x << 3) + (x << 1) + (tmp ^ '0');
  if (key) x = -x;
}
template <typename tp>
inline void ckmx(tp& x,tp y) {
  x = x < y ? y : x;
}
template <typename tp>
inline void ckmn(tp& x,tp y) {
  x = x < y ? x : y;
}

const int MOD = 998244353;
const int LIN[17] = {
  0,
  0,
  4,
  8,
  998244352,
  16,
  998244343,
  4,
  998244341,
  998244305,
  26,
  998244309,
  15,
  998244337,
  998244349,
  998244349,
  998244352
};
const int TABLE[16] = {
  0,
  0,
  24,
  4,
  240,
  204,
  1316,
  2988,
  6720,
  26200,
  50248,
  174280,
  436904,
  1140888,
  3436404,
  8348748
};
const int N = 50010;
inline void Add(int &x,int y) {
  x = x + y >= MOD ? x + y - MOD : x + y;
}
int n, dp[N];
int main() {
  read(n);
  rep (i, 1, 16) dp[i] = TABLE[i-1];
  rep (i, 17, n) rep (j, 1, 16)
    Add(dp[i], 1ll * dp[i-j] * LIN[j] % MOD);
  printf("%d\n", dp[n]);
  return 0;
}

//加油吧
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod=998244353,N=200200,G=3,Gi=332748118;
ll power(ll base,ll b){
	ll ret=1;
	while(b){
		if(b&1)ret=ret*base%mod;
		base=base*base%mod;
		b>>=1;
	}
	return ret;
}
int limit,len,last=-1,pos[N];
ll G0[N],G1[N],G2[N],g[N],F0[N],F1[N],F2[N];
//F0是两端都没有距离为2的点
//F1是一端有距离为2的点  (答案统计时有两种方案数相同的情况)
//F2是两端都有距离为2的点
inline void getlen(int n){
	limit=1,len=0;
	while(limit<n)limit<<=1,++len;
	if(last==limit)return;
	last=limit;
	for(int i=1;i<limit;++i)
		pos[i]=(pos[i>>1]>>1)|((i&1)<<(len-1));
}
inline void ntt(ll *a,int n,int type){
	for(int i=0;i<limit;++i)
		if(i<pos[i])swap(a[i],a[pos[i]]);
	for(int mid=1;mid<limit;mid<<=1){
		ll wn=power((type==1?G:Gi),(mod-1)/(mid<<1));
		for(int j=0;j<limit;j+=(mid<<1)){
			ll w=1;
			for(int k=0;k<mid;++k,w=w*wn%mod){
				ll x=a[j+k],y=a[j+mid+k]*w%mod;
				a[j+k]=(x+y)%mod;
				a[j+mid+k]=(x-y+mod)%mod;
			}
		}
	}
	if(type==-1){
		ll inv=power(limit,mod-2);
		for(int i=0;i<n;++i)a[i]=a[i]*inv%mod;
		for(int i=n;i<limit;++i)a[i]=0;
	}
}
ll f[N],h[N],tmp[N];
void calc(ll *a,int n,ll *b,int m,ll *c,int nm=-1){
	if(nm==-1)nm=n+m-1;
	getlen(nm);
	for(int i=0;i<n;++i)f[i]=a[i];
	for(int i=n;i<limit;++i)f[i]=0;
	for(int i=0;i<m;++i)h[i]=b[i];
	for(int i=m;i<limit;++i)h[i]=0;
	ntt(f,nm,1),ntt(h,nm,1);
	for(int i=0;i<limit;++i)f[i]=f[i]*h[i]%mod;
	ntt(f,nm,-1);
	for(int i=0;i<nm;++i)c[i]=f[i];
}
void CDQ(int l,int r){
	if(l==r){
		F0[l]=(F0[l]+G0[l])%mod;
		F1[l]=(F1[l]+G1[l])%mod;
		F2[l]=(F2[l]+G2[l])%mod;
		return;
	}
	int mid=(l+r)>>1;
	CDQ(l,mid);
	calc(F0+l,mid-l+1,G0,r-l+1,tmp+l,r-l+1);
	for(int i=mid+1;i<=r;++i)F0[i]=(F0[i]+tmp[i])%mod;
	calc(F0+l,mid-l+1,G1,r-l+1,tmp+l,r-l+1);
	for(int i=mid+1;i<=r;++i)F1[i]=(F1[i]+tmp[i])%mod;
	calc(F1+l,mid-l+1,G1,r-l+1,tmp+l,r-l+1);
	for(int i=mid+1;i<=r;++i)F0[i]=(F0[i]+tmp[i])%mod;
	for(int i=mid+1;i<=r;++i)F2[i]=(F2[i]+tmp[i])%mod;
	calc(F1+l,mid-l+1,G2,r-l+1,tmp+l,r-l+1);
	for(int i=mid+1;i<=r;++i)F1[i]=(F1[i]+tmp[i])%mod;
	calc(F2+l,mid-l+1,G2,r-l+1,tmp+l,r-l+1);
	for(int i=mid+1;i<=r;++i)F2[i]=(F2[i]+tmp[i])%mod;
	//注意是左边对右边的贡献
	CDQ(mid+1,r);
}
int n;
int main(){
//	freopen("y.in","r",stdin);
	scanf("%d",&n);
	g[0]=g[2]=1;
	for(int i=4;i<=n;++i)g[i]=(g[i-2]+g[i-4])%mod;
	for(int i=1;i<=n;++i)G0[i]=1LL*(i-1)*(i-1)%mod*g[i-1]%mod;
	for(int i=2;i<=n;++i)G1[i]=1LL*(i-1)*(i-1)%mod*g[i-2]%mod;
	for(int i=3;i<=n;++i)G2[i]=1LL*(i-1)*(i-1)%mod*g[i-3]%mod;
	CDQ(1,n);
	ll Ans=1LL*n*(G0[n]+G2[n])%mod;//可以旋转n次
	for(int i=2;i<=n-2;++i){
		Ans=(Ans+(G0[i]*F0[n-i]%mod+2LL*G1[i]*F1[n-i]%mod+G2[i]*F2[n-i]%mod)*(ll)i%mod)%mod;//把第一个相对的点对旋转到1-n+1处
	}
	printf("%lld\n",(Ans%mod+mod)%mod);
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef bool boolean;

#define ll long long

template <typename T>
void pfill(T* pst, const T* ped, T val) {
	for ( ; pst != ped; *(pst++) = val);
}

template <typename T>
void pcopy(T* pst, const T* ped, T* pval) {
	for ( ; pst != ped; *(pst++) = *(pval++));
}

void exgcd(int a, int b, int& x, int& y) {
	if (!b) {
		x = 1, y = 0;
	} else {
		exgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
}

int inv(int a, int n) {
	int x, y;
	exgcd(a, n, x, y);
	return (x < 0) ? (x + n) : (x);
}

const int N = 131072;
const int Mod = 998244353;
const int bzmax = 19;
const int g = 3;

template <const int Mod = :: Mod>
class Z {
	public:
		int v;

		Z() : v(0) {	}
		Z(int x) : v(x){	}
		Z(ll x) : v(x % Mod) {	}

		friend Z operator + (const Z& a, const Z& b) {
			int x;
			return Z(((x = a.v + b.v) >= Mod) ? (x - Mod) : (x));
		}
		friend Z operator - (const Z& a, const Z& b) {
			int x;
			return Z(((x = a.v - b.v) < 0) ? (x + Mod) : (x));
		}
		friend Z operator * (const Z& a, const Z& b) {
			return Z(a.v * 1ll * b.v);
		}
		friend Z operator ~(const Z& a) {
			return inv(a.v, Mod);
		}
		friend Z operator - (const Z& a) {
			return Z(0) - a;
		}
		Z& operator += (Z b) {
			return *this = *this + b;
		}
		Z& operator -= (Z b) {
			return *this = *this - b;
		}
		Z& operator *= (Z b) {
			return *this = *this * b;
		}
		friend boolean operator == (const Z& a, const Z& b) {
			return a.v == b.v;
		}
};

typedef Z<> Zi;

Zi qpow(Zi a, int p) {
	if (p < Mod - 1)
		p += Mod - 1;
	Zi rt = 1, pa = a;
	for ( ; p; p >>= 1, pa = pa * pa) {
		if (p & 1) {
			rt = rt * pa;
		}
	}
	return rt;
}

class NTT {
	private:
		Zi gn[bzmax + 4], _gn[bzmax + 4];
	public:

		NTT() {
			for (int i = 0; i <= bzmax; i++) {
				gn[i] = qpow(Zi(g), (Mod - 1) >> i);
				_gn[i] = qpow(Zi(g), -((Mod - 1) >> i));
			}
		}

		template <typename T>
		void operator () (T* f, int len, int sgn) {
			for (int i = 1, j = len >> 1, k; i < len - 1; i++, j += k) {
				if (i < j)
					swap(f[i], f[j]);
				for (k = len >> 1; k <= j; j -= k, k >>= 1);
			}

			Zi *wn = (sgn > 0) ? (gn + 1) : (_gn + 1), w;
			T a, b;
			for (int l = 2, hl; l <= len; l <<= 1, wn++) {
				hl = l >> 1, w = 1;
				for (int i = 0; i < len; i += l, w = 1) {
					for (int j = 0; j < hl; j++, w *= *wn) {
						a = f[i + j], b = f[i + j + hl] * w;
						f[i + j] = a + b;
						f[i + j + hl] = a - b;
					}
				}
			}

			if (sgn < 0) {
				Zi invlen = ~Zi(len);
				for (int i = 0; i < len; i++) {
					f[i] = f[i] * invlen;
				}
			}
		}

		int correct_len(int len) {
			int m = 1;
			for ( ; m <= len; m <<= 1);
			return m;
		}
} NTT;

template <typename T>
void pol_inverse(T* f, T* g, int n) {
	static T A[N];
	if (n == 1) {
		g[0] = ~f[0];
	} else {
		int hn = (n + 1) >> 1, t = NTT.correct_len(n << 1 | 1);
		pol_inverse(f, g, hn);

		pcopy(A, A + n, f);
		pfill(A + n, A + t, T(0));
		pfill(g + hn, g + t, T(0));
		NTT(A, t, 1);
		NTT(g, t, 1);
		for (int i = 0; i < t; i++) {
			g[i] = g[i] * (T(2) - g[i] * A[i]);
		}
		NTT(g, t, -1);
		pfill(g + n, g + t, T(0));
	}
}

typedef vector<Zi> Poly;

Poly operator + (Poly A, Poly B) {
	int n = A.size(), m = B.size();
	int t = max(n, m);
	A.resize(t), B.resize(t);
	for (int i = 0; i < t; i++) {
		A[i] += B[i];
	}
	return A;
}

Poly operator - (Poly A, Poly B) {
	int n = A.size(), m = B.size();
	int t = max(n, m);
	A.resize(t), B.resize(t);
	for (int i = 0; i < t; i++) {
		A[i] -= B[i];
	}
	return A;
}

Poly operator * (Poly A, Poly B) {
	int n = A.size(), m = B.size();
	int k = NTT.correct_len(n + m - 1);
	if (n < 20 || m < 20) {
		Poly rt (n + m - 1);
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				rt[i + j] += A[i] * B[j];
			}
		}
		return rt;
	}
	A.resize(k), B.resize(k);
	NTT(A.data(), k, 1);
	NTT(B.data(), k, 1);
	for (int i = 0; i < k; i++) {
		A[i] *= B[i];
	}
	NTT(A.data(), k, -1);
	A.resize(n + m - 1);
	return A;
}

Poly operator ~ (Poly f) {
	int n = f.size(), t = NTT.correct_len((n << 1) | 1);
	Poly rt (t);
	f.resize(t);
	pol_inverse(f.data(), rt.data(), n);
	rt.resize(n);
	return rt;
}

typedef class Matrix {
	public:
		Zi a[2][2];

		Matrix() {	}
		Matrix(int x) {
			a[0][0] = a[1][1] = x;
			a[0][1] = a[1][0] = 0;
		}

		Zi* operator [] (int p) {
			return a[p];
		}
		Matrix operator * (Matrix b) {
			Matrix rt;
			rt[0][0] = a[0][0] * b[0][0] + a[0][1] * b[1][0];
			rt[0][1] = a[0][0] * b[0][1] + a[0][1] * b[1][1];
			rt[1][0] = a[1][0] * b[0][0] + a[1][1] * b[1][0];
			rt[1][1] = a[1][0] * b[0][1] + a[1][1] * b[1][1];
			return rt;
		}
		Matrix operator - (Matrix b) {
			Matrix rt;
			rt[0][0] = a[0][0] - b[0][0];
			rt[0][1] = a[0][1] - b[0][1];
			rt[1][0] = a[1][0] - b[1][0];
			rt[1][1] = a[1][1] - b[1][1];
			return rt;
		}
		Matrix operator + (Matrix b) {
			Matrix rt;
			rt[0][0] = a[0][0] + b[0][0];
			rt[0][1] = a[0][1] + b[0][1];
			rt[1][0] = a[1][0] + b[1][0];
			rt[1][1] = a[1][1] + b[1][1];
			return rt;
		}
		Matrix operator * (Zi x) {
			Matrix rt;
			rt[0][0] = a[0][0] * x;
			rt[0][1] = a[0][1] * x;
			rt[1][0] = a[1][0] * x;
			rt[1][1] = a[1][1] * x;
			return rt;
		}
} Matrix;

#define g _g

int n;
Zi dp[N][2][2];
Matrix f[N], g[N], G[N];

int main() {

	scanf("%d", &n);
	for (int s = 0; s < 2; s++) {
		memset(dp, 0, sizeof(dp));
		dp[1][0][0] = g[1][s][0] = (s == 1);
		dp[1][0][1] = g[1][s][1] = (s == 0);
		for (int i = 2; i < n; i++) {
			dp[i][0][0] = dp[i - 1][0][1] + dp[i - 1][1][0];
			dp[i][0][1] = dp[i - 1][0][0];
			dp[i][1][0] = dp[i - 1][1][1];
			dp[i][1][1] = dp[i - 1][0][1];
			g[i][s][0] = dp[i][0][0] * i * i;
			g[i][s][1] = dp[i][0][1] * i * i;
		}
	}

	Zi ans = 0;
	/* for (int s = 0; s < 2; s++) {
		f[1][s][s] = 1;
		for (int i = 2; i < n; i++) {
			for (int j = 0; j < i; j++) {
				f[i][s][0] += f[i - j - 1][s][1] * g[j][1][0];
				f[i][s][0] += f[i - j - 1][s][0] * g[j][0][0];
				f[i][s][1] += f[i - j - 1][s][1] * g[j][1][1];
				f[i][s][1] += f[i - j - 1][s][0] * g[j][0][1];
			}
		}
	} */

	for (int i = 1; i <= n; i++) {
		G[i] = g[i - 1] * Zi(Mod - 1);
	}
	G[0] = Matrix(1);
//	pol_inverse(G, f, n + 1);
	Poly A (n + 1), B(n + 1), C(n + 1), D(n + 1);
	for (int i = 0; i <= n; i++) {
		A[i] = G[i][0][0];
		B[i] = G[i][0][1];
		C[i] = G[i][1][0];
		D[i] = G[i][1][1];
	}
	Poly _A = D, _B = B * Poly {Mod - 1}, _C = C * Poly {Mod - 1}, _D = A;
	Poly E = A * D - B * C;
	E.resize(n + 1);
	E = ~E;
	_A = _A * E;
	_B = _B * E;
	_C = _C * E;
	_D = _D * E;
	for (int i = 1; i <= n; i++) {
		f[i][0][0] = _A[i - 1];
		f[i][0][1] = _B[i - 1];
		f[i][1][0] = _C[i - 1];
		f[i][1][1] = _D[i - 1];
	}

	for (int i = 1; i < n; i++) {
		if (i != n - 1) {
			ans += f[n - i][0][0] * g[i][0][0] * (i + 1);
			ans += f[n - i][0][1] * g[i][1][0] * (i + 1);
			ans += f[n - i][1][0] * g[i][0][1] * (i + 1);
			ans += f[n - i][1][1] * g[i][1][1] * (i + 1);
		} else {
			ans += g[i][0][0] * (i + 1);
			ans += g[i][1][1] * (i + 1);
		}
	}
	printf("%d\n", ans.v);
	return 0;
}

#include <cstdio>
#include <cstring>
typedef long long int64;
static const int LOGN = 18;
static const int MAXN = 1 << LOGN;
static const int MODULUS = 998244353;
static const int PRIMITIVE = 2192;
#define _  %  MODULUS
#define __ %= MODULUS
template <typename T> inline void swap(T &a, T &b) { static T t; t = a; a = b; b = t; }

int n;
int64 g[MAXN];
int64 g0[MAXN], g1[MAXN], g2[MAXN];
int64 f0[MAXN], f1[MAXN], f2[MAXN];

int64 q0[MAXN], q1[MAXN];
int64 t1[MAXN], t2[MAXN], t3[MAXN], t4[MAXN];

inline int qpow(int64 base, int exp)
{
    int64 ans = 1;
    for (; exp; exp >>= 1) { if (exp & 1) (ans *= base)__; (base *= base)__; }
    return ans;
}

int bitrev[LOGN][MAXN];
int root[2][LOGN];
inline void fft(int n, int64 *a, int direction)
{
    int s = __builtin_ctz(n);
    int64 u, v, r, w;
    for (int i = 0; i < n; ++i) if (i < bitrev[s][i]) swap(a[i], a[bitrev[s][i]]);
    for (int i = 1; i <= n; i <<= 1)
        for (int j = 0; j < n; j += i) {
            r = root[direction == -1][__builtin_ctz(i)];
            w = 1;
            for (int k = j; k < j + (i >> 1); ++k) {
                u = a[k];
                v = (a[k + (i >> 1)] * w)_;
                a[k] = (u + v)_;
                a[k + (i >> 1)] = (u - v + MODULUS)_;
                w = (w * r)_;
            }
        }
}

inline void convolve(int n, int64 *a, int64 *b, int64 *c)
{
    static int64 a1[MAXN], b1[MAXN];
    memcpy(a1, a, n * 2 * sizeof(int64));
    memcpy(b1, b, n * 2 * sizeof(int64));
    memset(a + n, 0, n * sizeof(int64));
    memset(b + n, 0, n * sizeof(int64));
    fft(n * 2, a, +1);
    fft(n * 2, b, +1);
    int64 q = qpow(n * 2, MODULUS - 2);
    for (int i = 0; i < n * 2; ++i) c[i] = a[i] * b[i]_;
    fft(n * 2, c, -1);
    for (int i = 0; i < n; ++i) c[i] = c[i] * q _;
    memcpy(a, a1, n * 2 * sizeof(int64));
    memcpy(b, b1, n * 2 * sizeof(int64));
}

// Calcukates f0 and f1.
void solve_1(int l, int r)
{
    if (l == r) {
        (f0[l] += g0[l])__;
        (f1[l] += g1[l])__;
        return;
    }

    int m = (l + r) >> 1;

    solve_1(l, m);

    int len = 1;
    while (len < r - l + 1) len <<= 1;
    for (int i = 0; i < len; ++i) q0[i] = (i + l <= m ? f0[i + l] : 0);
    for (int i = 0; i < len; ++i) q1[i] = (i + l <= m ? f1[i + l] : 0);
    for (int i = len; i < len * 2; ++i) q0[i] = q1[i] = 0;
    convolve(len, g0, q0, t1);
    convolve(len, g1, q0, t2);
    convolve(len, g1, q1, t3);
    convolve(len, g2, q1, t4);

    for (int i = 0; i < len; ++i) {
        if (i + l >= m + 1 - 1 && i + l <= r - 1) {
            (f0[i + l + 1] += t1[i])__;
            (f1[i + l + 1] += t2[i])__;
        }
        if (i + l >= m + 1 - 3 && i + l <= r - 3) {
            (f0[i + l + 3] += t3[i])__;
            (f1[i + l + 3] += t4[i])__;
        }
    }

    solve_1(m + 1, r);
}

// Calculates f2.
void solve_2(int l, int r)
{
    if (l == r) {
        (f2[l] += (g2[l] + (l >= 1 ? t1[l - 1] : 0)))__;
        return;
    }

    int m = (l + r) >> 1;

    solve_2(l, m);

    int len = 1;
    while (len < r - l + 1) len <<= 1;
    for (int i = 0; i < len; ++i) q0[i] = (i + l <= m ? f2[i + l] : 0);
    for (int i = len; i < len * 2; ++i) q0[i] = 0;
    convolve(len, g2, q0, t2);

    for (int i = 0; i < len; ++i) {
        if (i + l >= m + 1 - 3 && i + l <= r - 3) {
            (f2[i + l + 3] += t2[i])__;
        }
    }

    solve_2(m + 1, r);
}

int main()
{
    for (int s = 0; s < LOGN; ++s)
        for (int i = 0; i < (1 << s); ++i)
            bitrev[s][i] = (bitrev[s][i >> 1] >> 1) | ((i & 1) << (s - 1));
    for (int i = 0; i < LOGN; ++i) {
        root[0][i] = qpow(PRIMITIVE, MAXN >> i);
        root[1][i] = qpow(PRIMITIVE, MAXN - (MAXN >> i));
    }

    scanf("%d", &n);

    g[0] = 1;
    g[2] = 1;
    for (int i = 4; i <= n; i += 2) g[i] = (g[i - 4] + g[i - 2])_;
    for (int i = 0; i <= n; ++i) {
        g0[i] = g[i] * i _ * i _;
        g1[i] = g[i] * (i + 1)_ * (i + 1)_;
        g2[i] = g[i] * (i + 2)_ * (i + 2)_;
    }

    solve_1(0, n);

    int len = 1;
    while (len < n) len <<= 1;
    convolve(len, g1, f1, t1);
    solve_2(0, n);

    int64 ans = 0;

    ans += (g[n - 1] + g[n - 3]) * (n - 1)_ * (n - 1)_ * n _;
    for (int i = 2; i <= n - 2; ++i) {
        ans += g0[i - 1] * f0[n - i - 1]_ * i _;
        ans += g1[i - 2] * f1[n - i - 2]_ * 2 * i _;
        if (i >= 3 && i <= n - 3)
            ans += g2[i - 3] * f2[n - i - 3]_ * i _;
    }

    printf("%lld\n", ans _);

    return 0;
}

#pragma GCC optimize(3,"inline","Ofast")
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll mod=998244353;
const int N=4e5+100;

ll Add(ll x,ll y)
{return (x+y)%mod;}
ll Sub(ll x,ll y)
{return (x-y+mod)%mod;}
ll Mul(ll x,ll y)
{return x*y%mod;}
ll qpow(ll x,ll y=mod-2)
{
	ll res=1;
	while(y)
	{
		if(y&1)res=Mul(res,x);
		x=Mul(x,x),y>>=1;
	}
	return res;
}

ll F[N],G[N];
int wh[N],len,cc;
void ntt(ll *a,bool inv)
{
	for(int i=1;i<len;i++)
		if(i<wh[i])swap(a[i],a[wh[i]]);
	ll tp,mo,ha;
	for(int l=2,md;l<=len;l<<=1)
	{
		md=l>>1,tp=qpow(3,(mod-1)/l);
		for(int i=0;i<len;i+=l)
		{
			mo=1;
			for(int j=0;j<md;j++,mo=Mul(mo,tp))
			{
				ha=Mul(a[i+j+md],mo);
				a[i+j+md]=Sub(a[i+j],ha);
				a[i+j]=Add(a[i+j],ha);
			}
		}
	}
	if(inv)
	{
		tp=qpow(len);
		for(int i=1;i<len/2;i++)swap(a[i],a[len-i]);
		for(int i=0;i<len;i++)a[i]=Mul(a[i],tp);
	}
}
void pre_ntt(int le)
{
	cc=0,len=1;
	while(len<=le)++cc,len<<=1;
	for(int i=1;i<len;i++)
		wh[i]=(wh[i>>1]>>1)|((i&1)<<(cc-1));
}
void clr()
{for(int i=0;i<len;i++)F[i]=G[i]=0;}

int n;
ll f0[N],f1[N],f2[N],g[N];

void sol1(int l,int r)
{
	if(l==r)
	{
		f0[l]=Add(f0[l],Mul(g[l],Mul(l,l)));
		f1[l]=Add(f1[l],Mul(g[l],Mul(l+1,l+1)));
		return;
	}
	int mid=(l+r)>>1;
	sol1(l,mid);
	pre_ntt(mid-l+1+r-l+1);
	clr();//bg f0
	for(int i=l;i<=mid;i++)
		F[i-l]=f0[i];
	for(int i=0;i<=r-l;i++)
		G[i]=Mul(g[i],Mul(i,i));
	ntt(F,0),ntt(G,0);
	for(int i=0;i<len;i++)F[i]=Mul(F[i],G[i]);
	ntt(F,1);
	for(int i=mid+1;i<=r;i++)
		if(i-l-1>=0)f0[i]=Add(f0[i],F[i-l-1]);
	clr();
	for(int i=l;i<=mid;i++)
		F[i-l]=f1[i];
	for(int i=0;i<=r-l;i++)
		G[i]=Mul(g[i],Mul(i+1,i+1));
	//f(l==0&&r==3)cerr<<F[0]<<' '<<G[0]<<'\n';
	ntt(F,0),ntt(G,0);
	for(int i=0;i<len;i++)F[i]=Mul(F[i],G[i]);
	ntt(F,1);
	//if(l==0&&r==3)cerr<<F[0]<<'\n';
	for(int i=mid+1;i<=r;i++)
		if(i-l-3>=0)f0[i]=Add(f0[i],F[i-l-3]);
	clr();//bg f1
	for(int i=l;i<=mid;i++)
		F[i-l]=f0[i];
	for(int i=0;i<=r-l;i++)
		G[i]=Mul(g[i],Mul(i+1,i+1));
	ntt(F,0),ntt(G,0);
	for(int i=0;i<len;i++)F[i]=Mul(F[i],G[i]);
	ntt(F,1);
	for(int i=mid+1;i<=r;i++)
		if(i-l-1>=0)f1[i]=Add(f1[i],F[i-l-1]);
	clr();
	for(int i=l;i<=mid;i++)
		F[i-l]=f1[i];
	for(int i=0;i<=r-l;i++)
		G[i]=Mul(g[i],Mul(i+2,i+2));
	ntt(F,0),ntt(G,0);
	for(int i=0;i<len;i++)F[i]=Mul(F[i],G[i]);
	ntt(F,1);
	for(int i=mid+1;i<=r;i++)
		if(i-l-3>=0)f1[i]=Add(f1[i],F[i-l-3]);
	sol1(mid+1,r);
}

void sol2(int l,int r)
{
	if(l==r)
	{
		f2[l]=Add(f2[l],Mul(g[l],Mul(l+2,l+2)));
		return;
	}
	int mid=(l+r)>>1;
	sol2(l,mid);
	pre_ntt(mid-l+1+r-l+1);
	clr();//bg f2
	for(int i=l;i<=mid;i++)
		F[i-l]=f1[i];
	for(int i=0;i<=r-l;i++)
		G[i]=Mul(g[i],Mul(i+1,i+1));
	ntt(F,0),ntt(G,0);
	for(int i=0;i<len;i++)F[i]=Mul(F[i],G[i]);
	ntt(F,1);
	for(int i=mid+1;i<=r;i++)
		if(i-l-1>=0)f2[i]=Add(f2[i],F[i-l-1]);
	clr();
	for(int i=l;i<=mid;i++)
		F[i-l]=f2[i];
	for(int i=0;i<=r-l;i++)
		G[i]=Mul(g[i],Mul(i+2,i+2));
	//f(l==0&&r==3)cerr<<F[0]<<' '<<G[0]<<'\n';
	ntt(F,0),ntt(G,0);
	for(int i=0;i<len;i++)F[i]=Mul(F[i],G[i]);
	ntt(F,1);
	//if(l==0&&r==3)cerr<<F[0]<<'\n';
	for(int i=mid+1;i<=r;i++)
		if(i-l-3>=0)f2[i]=Add(f2[i],F[i-l-3]);
	sol2(mid+1,r);
}

signed main()
{
	cin>>n;
	g[0]=g[2]=1;
	for(int i=4;i<=n;i++)g[i]=Add(g[i-2],g[i-4]);
	sol1(0,n),sol2(0,n);
	ll ans=0,res;
	ans=Add(ans,1LL*(n-1)*(n-1)%mod*g[n-1]%mod*n%mod);
	ans=Add(ans,1LL*(n-1)*(n-1)%mod*g[n-3]%mod*n%mod);
//	cout<<f0[1]<<'\n';
	for(int x=0;x<=n-2;x++)
	{
		res=0;
		res=Add(res,Mul(Mul(Mul(x,x),g[x]),f0[n-x-2]));
	//	if(res)cerr<<x<<' '<<res<<'\n';
		if(n-x-3>=0&&x>=1)res=Add(res,2LL*x*x%mod*g[x-1]%mod*f1[n-x-3]%mod);
	//	if(res)cerr<<x<<' '<<res<<'\n';
		if(n-x-4>=0&&x>=2)res=Add(res,1LL*x*x%mod*g[x-2]%mod*f2[n-x-4]%mod);
	//	if(res)cerr<<x<<' '<<res<<'\n';
		ans=Add(ans,Mul(res,x+1));
	//	if(res)cerr<<x<<' '<<res<<'\n';
	}
	printf("%lld\n",ans);
	return 0;
}

#include<cstdio>
#include<algorithm>
using namespace std;const int N=1e5+10;const int S=40;
typedef unsigned long long ll;const ll mod=998244353;
struct poly
{
    int a[S+10];
    inline int& operator [](const int & x){return a[x];}
    poly(){for(int i=0;i<S;i++)a[i]=0;}
    friend poly operator * (poly a,poly b)
    {
        poly c;for(int i=0;i<S;i++)
            for(int j=0;j<S&&i+j<S;j++)c[i+j]+=a[i]*b[j];return c;
    }
    friend poly operator +(poly a,poly b){poly c;for(int i=0;i<S;i++)c[i]=a[i]+b[i];return c;}
    friend poly operator -(poly a,poly b){poly c;for(int i=0;i<S;i++)c[i]=a[i]-b[i];return c;}
    poly operator <<(const int& x){poly c;for(int i=S-1;i>=x;i--)c[i]=a[i-x];return c;}
}a,b,c,q,fz,fm,fz1,fm1;int n;
ll f0[N];ll c0[N];ll f1[N];ll c1[N];ll f2[N];ll c2[N];ll g[N];ll sqr[N];
inline void calc(poly& fz,poly& fm,ll* f,ll* c)//暴力除法
{
    for(int i=0;i<S;i++)f[i]=(mod+fz[i])%mod;
    for(int i=0;i<S;i++)c[i]=(mod-fm[i])%mod;(c[0]+=1)%=mod;
    for(int i=0;i<=n;i++)
        for(int j=1;j<S&&j<=i;j++)(f[i]+=f[i-j]*c[j])%=mod;
}
int main()
{
    a[8]=16;a[6]=12;a[4]=20;a[2]=4;b[8]=9;b[6]=2;b[4]=23;b[2]=6;b[0]=1;
    c[8]=4;c[6]=-4;c[4]=24;c[2]=4;c[0]=4;q[12]=-1;q[10]=-3;q[6]=+5;q[2]=-3;q[0]=+1;
    scanf("%d",&n);//按照推出来的柿子计算f1,f2,f3
    fz=((b*b)<<3)-a*((c<<3)-q);fm=((c<<3)-q)*((a<<1)-q)-((b*b)<<4);calc(fz,fm,f0,c0);
    fz=b*q;fm=((c<<3)-q)*((a<<1)-q)-((b*b)<<4);calc(fz,fm,f1,c1);
    fz1=c*fm+((b*fz)<<1);fm1=fm*(q-(c<<3));calc(fz1,fm1,f2,c2);
    g[0]=1;g[2]=1;for(int i=4;i<=n;i++)g[i]=(g[i-2]+g[i-4])%mod;
    for(int i=1;i<=n;i++)sqr[i]=(ll)i*i%mod;
    ll ans=(g[n-1]+g[n-3])*sqr[n-1]%mod*n%mod;
    for(int i=2;i<=n-2;i++)
    {
        ll ret=0;(ret+=g[i-1]*f0[n-i-1])%=mod;(ret+=g[i-2]*f1[n-i-2]*2)%=mod;
        if(3<=i&&i<=n-3)(ret+=g[i-3]*f2[n-i-3])%=mod;
        (ans+=ret*sqr[i-1]%mod*i)%=mod;
    }printf("%I64d",ans);//拜拜程序~
}

#include <algorithm>
#include <cstdio>

typedef long long ll;

const int mod=998244353;

const int N=3e5;

int n,lim,cnt,r[N],a[N],b[N];

int g[N],g0[N],g1[N],g2[N];

int f0[N],f1[N],f2[N];

int q0[N],q1[N];

int t1[N],t2[N],t3[N],t4[N];

inline void add(int& x,int y){
	x+=y; if(x>=mod) x-=mod;
}
inline int mul(int x,int y){
	return (ll)x*y%mod;
}

inline int fpow(int x,int k){
	int res=1;
	for(;k;k>>=1,x=mul(x,x)){
		if(k&1) res=mul(res,x);
	}
	return res;
}

inline void ntt_prepare(int len){
	for(lim=1,cnt=0;lim<len;lim<<=1,++cnt);
	for(int i=0;i<lim;++i) r[i]=(r[i>>1]>>1)|((i&1)<<(cnt-1));
}

void ntt(int *a,int op){
	for(int i=0;i<lim;++i) if(i<r[i]) std::swap(a[i],a[r[i]]);
	for(int i=1,wn;i<lim;i<<=1){
		if(op==1) wn=fpow(3,(mod-1)/(i<<1));
		else wn=fpow(3,mod-1-(mod-1)/(i<<1));
		for(int j=0;j<lim;j+=i<<1){
			int w=1;
			for(int k=0;k<i;++k,w=mul(w,wn)){
				int p=a[j+k],q=mul(w,a[j+i+k]);
				a[j+k]=(p+q)%mod; a[j+i+k]=(p+mod-q)%mod;
			}
		}
	}
	if(op==-1){
		int inv_lim=fpow(lim,mod-2);
		for(int i=0;i<lim;++i) a[i]=mul(a[i],inv_lim);
	}
}

void Convolve(int *_a,int *_b,int *_c){
	for(int i=0;i<lim/2;++i) a[i]=_a[i];
	for(int i=0;i<lim/2;++i) b[i]=_b[i];
	for(int i=lim/2;i<lim;++i) a[i]=b[i]=0;
	ntt(a,1); ntt(b,1);
	for(int i=0;i<lim;++i) _c[i]=mul(a[i],b[i]);
	ntt(_c,-1);
}

void solve_1(int l,int r){
	if(l==r){
		add(f0[l],g0[l]);
		add(f1[l],g1[l]);
		return;
	}
	int mid=(l+r)/2; solve_1(l,mid);
	ntt_prepare(2*(r-l+1));
	for(int i=0;i<lim;++i) q0[i]=(i+l<=mid?f0[i+l]:0);
	for(int i=0;i<lim;++i) q1[i]=(i+l<=mid?f1[i+l]:0);
	Convolve(g0,q0,t1); Convolve(g1,q0,t2);
	Convolve(g1,q1,t3); Convolve(g2,q1,t4);
	for(int i=0;i<lim/2;++i){
		if(mid+1<=i+l+1&&i+l+1<=r){
			add(f0[i+l+1],t1[i]); add(f1[i+l+1],t2[i]);
		}
		if(mid+1<=i+l+3&&i+l+3<=r){
			add(f0[i+l+3],t3[i]); add(f1[i+l+3],t4[i]);
		}
	}
	solve_1(mid+1,r);
}

void solve_2(int l,int r){
	if(l==r){
		add(f2[l],g2[l]);
		add(f2[l],l>=1?t1[l-1]:0);
		return;
	}
	int mid=(l+r)/2; solve_2(l,mid);
	ntt_prepare(2*(r-l+1));
	for(int i=0;i<lim;++i) q0[i]=(i+l<=mid?f2[i+l]:0);
	Convolve(g2,q0,t2);
	for(int i=0;i<lim/2;++i){
		if(mid+1-3<=i+l&&i+l<=r-3) add(f2[i+l+3],t2[i]);
	}
	solve_2(mid+1,r);
}

int main(){
	scanf("%d",&n); g[0]=1; g[2]=1;
	for(int i=4;i<=n;i+=2) g[i]=(g[i-2]+g[i-4])%mod;
	for(int i=0;i<=n;++i){
		g0[i]=mul(g[i],mul(i,i));
		g1[i]=mul(g[i],mul(i+1,i+1));
		g2[i]=mul(g[i],mul(i+2,i+2));
	}
	solve_1(0,n); ntt_prepare(2*n);
	Convolve(g1,f1,t1); solve_2(0,n);
	int ans=mul(mul((g[n-1]+g[n-3])%mod,mul(n-1,n-1)),n);
	for(int i=2;i<=n-2;++i){
		add(ans,mul(mul(mul(g[i-1],mul(i-1,i-1)),f0[n-i-1]),i));
		add(ans,mul(mul(mul(g[i-2],mul(i-1,i-1)),f1[n-i-2]),mul(2,i)));
		if(3<=i&&i<=n-3) add(ans,mul(mul(mul(g[i-3],mul(i-1,i-1)),f2[n-i-3]),i));
	}
	printf("%d\n",ans);
	return 0;
}

#include <cstdio>
#include <vector>
#include <algorithm>

const int P=998244353;
inline int mul(const int &a,const int &b){return 1ll*a*b%P;}
inline int sub(int a,const int &b){a-=b;return (a<0)?a+P:a;}
inline int add(int a,const int &b){a+=b;return(a>=P)?a-P:a;}
typedef std::vector<int> poly;
poly operator*(poly a,poly b){
	int size=a.size()+b.size()-1;
	poly c(size);
	for(int i=0;i<a.size();i++)
		for(int j=0;j<b.size();j++)
			c[i+j]=add(c[i+j],mul(a[i],b[j]));
	return c;
}
poly operator+(poly a,poly b){
	if(a.size()<b.size())a.resize(b.size());
	for(int i=0;i<b.size();i++)a[i]=add(a[i],b[i]);
	return a;
}
poly operator-(poly a,poly b){
	if(a.size()<b.size())a.resize(b.size());
	for(int i=0;i<b.size();i++)a[i]=sub(a[i],b[i]);
	return a;
}
poly diff(poly a){
	for(int i=0;i<a.size()-1;i++)a[i]=mul(a[i+1],i+1);
	a.pop_back();
	return a;
}
poly lift(poly a,int n){
	a.resize(a.size()+n);
	for(int i=a.size()-1;i>=n;i--)a[i]=a[i-n];
	for(int i=0;i<n;i++)a[i]=0;
	return a;
}
struct fract{
	poly a,b;
	fract operator*(fract c){return (fract){a*c.a,b*c.b};}
	fract operator+(fract c){return (fract){a*c.b+b*c.a,b*c.b};}
	fract diff(){return (fract){::diff(a)*b-::diff(b)*a,b*b};}
	fract sum(){return (fract){b,b-a};}
	void print(){
		for(int i=0;i<a.size();i++)printf("%d ",a[i]);putchar('\n');
		for(int i=0;i<b.size();i++)printf("%d ",b[i]);putchar('\n');
	}
}fib,H,C,tem,ans;
fract get(fract f){
	f=f.diff();
	f.a=lift(f.a,1);
	f=f.diff();
	f.a=lift(f.a,1);
	return f;
}
int f[50001];
int getval(int n,fract ans){
	f[0]=1;
	for(int i=1;i<=n;i++){
		f[i]=0;
		for(int j=1;j<ans.b.size();j++)
			if(i-j>=0)f[i]=sub(f[i],mul(f[i-j],ans.b[j]));
	}
	int Ans=0;
	for(int i=0;i<ans.a.size()&&n-i>=0;i++)Ans=add(Ans,mul(ans.a[i],f[n-i]));
	return Ans;
}
int main(){
	fib.a.push_back(1);
	fib.b.push_back(1);
	fib.b.push_back(0);
	fib.b.push_back(P-1);
	fib.b.push_back(0);
	fib.b.push_back(P-1);
//	for(int i=0;i<6;i++)printf("%d ",getval(i,fib));putchar('\n');
	tem=get(fib);
	tem.a=lift(tem.a,1);
	C=tem;
	fib.a=lift(fib.a,1);
	tem=get(fib);
	tem.a=lift(tem.a,1);
	fib.a=lift(fib.a,1);
	H=get(fib);
	H.a=lift(H.a,1);
	C=C+H.sum()*tem*tem;
	ans=H.diff()*H.sum()+C.diff()*C.sum();
	int n;
	scanf("%d",&n);
	printf("%d\n",getval(n-1,ans));
}

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define REP(i,n) for(int i=(0);i<(n);i++)
#define pb push_back
using namespace std;
typedef vector<int> vi;
typedef long long ll;

const int N=5005,mod=998244353;
namespace {
	inline int add(int x,int y){
		return x+y>=mod?x+y-mod:x+y;
	}
	inline void Add(int &x,int y){
		x=add(x,y);
	}
	inline int mnu(int x,int y){
		return x-y<0?x-y+mod:x-y;
	}
	inline int mul(int x,int y){
		return (ll)x*y%mod;
	}
	inline int power(int x,ll p){
		int res=1;
		for(;p;p>>=1,x=(ll)x*x%mod)
			if(p&1)res=(ll)res*x%mod;
		return res;
	}
	#define inv(x) power(x,mod-2)
}
namespace LS{
	/*
	note:
	所有下标均从零开始
	a[i]=\sum a[i-j-1]*r[j]
	初值为a[0]..a[sz-1]
	*/
	int p[N],d[N],m;vi s[N];
	vi BM(vi a){
		int n=a.size();
		for(;m;)s[m--].clear();
		REP(i,n){
			d[i]=a[i];
			REP(j,s[m].size())
				d[i]=mnu(d[i],mul(a[i-j-1],s[m][j]));
			if(!d[i])continue;
			p[m]=i;
			if(!m){s[++m].resize(i+1);continue;}
			int id=m-1;
			REP(j,m-1)
				id=(p[j]-s[j].size()>p[id]-s[id].size()?j:id);
			int coef=mul(d[i],inv(d[p[id]]));
			s[++m].resize(i-p[id]-1);
			s[m].pb(coef);
			REP(j,s[id].size())
				s[m].pb(mul(mod-coef,s[id][j]));
			REP(j,s[m-1].size())
				if(j<s[m].size())s[m][j]=add(s[m][j],s[m-1][j]);
				else s[m].pb(s[m-1][j]);
		}
		return s[m];
	}
	const ll Mod=(ll)mod*mod*8;
	#define fix(x) (x>=Mod?x-=Mod:0);
	int A[N],B[N],bin[N],res[N],n;
	inline void Mul(int *x,int *y){
		static ll t[N<<1];
		rep(k,0,n*2-2)t[k]=0;
		REP(i,n)REP(j,n)
			t[i+j]+=(ll)x[i]*y[j],fix(t[i+j]);
		per(i,n*2-2,n){
			t[i]%=mod;
			REP(j,n)t[i-j-1]+=t[i]*A[j],fix(t[i-j-1]);
			t[i]=0;
		}
		REP(i,n)x[i]=t[i]%mod;
	}
	int solve(vi a,vi b,ll K){
		n=a.size();
		if(K<=n-1)return b[K];
		if(n==1)return mul(b[0],power(a[0],K));
		REP(i,n){
			bin[i]=res[i]=0;
			A[i]=a[i],B[i]=b[i];
		}
		bin[1]=res[0]=1;
		for(K-=n-1;K;K>>=1,Mul(bin,bin))
			if(K&1)Mul(res,bin);
		rep(i,n,n*2-2){
			B[i]=0;
			REP(j,n)B[i]=add(B[i],mul(B[i-j-1],A[j]));
		}
		int s=0;
		REP(i,n)s=add(s,mul(B[n-1+i],res[i]));
		return s;
	}
	int gao(vi x,ll K){
		/*
		vi now=BM(x);
		for(auto k:now)
			printf("%d\n",k);
		*/
		return solve(BM(x),x,K);
	}
}

int main(){
	int n;
	while(cin>>n){
		cout<<LS::gao(
{
0,
0,
24,
4,
240,
204,
1316,
2988,
6720,
26200,
50248,
174280,
436904,
1140888,
3436404,
8348748,
24631232,
64575924,
174658944,
488230244,
282739095,
583167773,
599201163,
111178790,
470158977,
118436480,
744170002,
418128853,
620410921,
282515603,
777785540,
59207630,
823529776,
886871858,
80677633,
874800287,
754269413,
659807497,
302870971,
307001715,
264211711,
169914597,
217455182,
548001896,
931663380,
658691665,
613191252,
22871164,
565836890,
666518327,
188929235,
97423179,
455032445,
717982756,
539441982,
77438780,
234014454,
63591835,
276188758,
87061627,
589142059,
71560290,
497829060,
895660250,
9602112,
87249688,
809156981,
884961056,
489473914,
38355837,
557378761,
126045217,
967574207,
143516425,
781765744,
760308099,
611998475,
534658131,
705127621,
405296052,
130725397,
383882264,
339797204,
894552125,
642173491,
144522144,
616828675,
441682504,
530141864,
737616009,
254378861,
349151841,
960499864,
635895491,
703439047,
723914022,
321135473,
322633558,
620067986,
12093833,
822351402,
659961976,
706842879,
561291216,
525796494,
328337148,
648028167,
124106519,
616008520,
849931888,
965326244,
566564606,
948733043,
494673408,
778015207,
320838587,
584057197,
19138752,
338633763,
2795369,
116023179,
87343110,
755048303,
693913225,
633203517,
917421732,
392771790,
184903926,
230718811,
736924711,
153212817,
646988834,
510472548,
882942170,
518783834,
361484515,
459538173,
329456484,
554369598,
609474131,
416722004,
457099440,
641069069,
395837543,
540024737,
692062069,
668791506,
297463193,
24121894,
196697821,
622456966,
336162054,
402175127,
187465538,
723717805,
788124599,
213558871,
218006941,
909117311,
632990404,
453095337,
761563178,
675183777,
65645459,
737251485,
544953780,
707133098,
518601183,
510014957,
144175667,
694896999,
5132966,
770938263,
988105532,
993139770,
992648146,
968231178,
757580258,
111467943,
962642889,
293947071,
635761785,
903252364,
880635007,
340582359,
601171051,
596204340,
608385350,
96447354,
170209643,
892978709,
96358627,
631704937,
510623144,
823589704,
734901519,
198849820,
443284306,
404714884,
265202294,
636313593,
205914735,
347900276,
976831683,
186483899,
21887075,
201327860,
965905146,
621833151,
771966889,
636781107,
896372632,
154183478,
662497325,
414854040,
476284151,
545384984,
540615508,
762869462,
466278305,
360289249,
906774385,
819706508,
545847035,
16175824,
970073352,
224313178,
59546687,
205957928,
581297271,
315714206,
572055762,
422271260,
873258937,
179398666,
941928204,
588892302,
349155227,
528608247,
798300465,
480959870,
312661201,
41870470,
146113758,
276077986,
762541617,
701618814,
224435446,
142161591,
932843904,
541939360,
359694866,
417944589,
531716774,
53250117,
831279892,
196457627,
328901101,
199591351,
726393518,
232830517,
471587277,
32596934,
777902298,
716721363,
806777291,
90943953,
976730647,
981553380,
632749748,
72677918,
549639218,
937403145,
439874286,
690359586,
406888968,
60471701,
74652172,
301539105,
239897075,
198274926,
400939125,
386441798,
980063218,
452346818,
425499498,
398182456,
195254196,
558937901,
446029750,
57168844,
165612584,
484135719,
502019278,
201027701,
953882240,
455149338,
821659780,
979126652,
410127454,
898992599,
629840170,
383055083,
555596464,
552501072,
553451665,
858360031,
841753627,
917469660,
168438866,
267191837,
689627020,
732200727,
479743711,
478477529,
711441933,
973845304,
120246779,
926672837,
82681084,
888542805,
704381361,
575987574,
956958177,
271109094,
508642463,
517529137,
117284561,
104949020,
239460677,
581781710,
243236907,
414694841,
540969299,
31915666,
278600946,
949842333,
139262061,
678740693,
740413276,
427739297,
937653616,
978335223,
492570661,
740066193,
471678685,
835700356,
154049589,
130782143,
299832885,
711012342,
936608322,
9757370,
909554876,
94767676,
836527215,
864709349,
498732135,
37571650,
703837237,
49752466,
103831961,
480858740,
624563082,
323617361,
793093598,
364140963,
49440506,
205518831,
205667944,
984175212,
163944597,
185097826,
864274985,
395692587,
964175569,
57614617,
515547536,
148793702,
796030853,
417133706,
659810083,
835625337,
366719923,
887579494,
729065646,
376686937,
63549509,
650671269,
137840814,
489656428,
517118927,
748010743,
362039418,
934547101,
994574954,
678653466,
240559586,
877378818,
975363290,
52833268,
71651036,
147367473,
370165896,
106286409,
649322045,
175614716,
376980481,
569409881,
826109327,
806440377,
147023541,
769463174,
72379314,
685945687,
216177851,
859769166,
57956054,
502354321,
582758263,
872133331,
502026091,
586426437,
34686044,
78821704,
951893097,
356781871,
460977849,
340499325,
485721206,
767293469,
541431854,
442627585,
82477268,
460866339,
784073674,
471441679,
614039455,
799349582,
69893864,
556765413,
236530383,
583487278,
7072830,
857776727,
365336353,
877251650,
229627563,
395906273,
171384799,
547937228,
48836753,
757954425,
335381846,
162329498,
290381679,
435856641,
337378527,
527247160,
393192739,
438743359,
261268459,
197560078,
464521571,
388068697,
111347438,
720703381,
226197595,
726038666,
625235922,
358996759,
538274583,
590502795,
924693256,
508110293,
333782460,
757067627,
229751189,
252656114,
829930757,
431486760,
484536013,
480523237,
653565388,
966422450,
938008959,
250443071,
175366477,
208954644,
562809351,
778712396,
15797041,
86580171,
229078187,
718621612,
575700836,
316528272,
476241143,
75035195,
587457040,
},
		n-1)<<endl;
	}
	return 0;
}

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long LL;
typedef vector <int> poly;
const int mo=998244353;
const int gx=3;
const int N=1e6;
int Sum(int x,int y) {
    x+=y;
    return (x>mo)?x-mo:x;
}
int Sub(int x,int y) {
    x-=y;
    return (x<0)?x+mo:x;
}
int Mul(int x,int y) {
    return (LL)x*y%mo;
}
int Pow(int x,LL y) {
    int z=1;
    while (y) {
        if (y&1) z=Mul(z,x);
        y>>=1;
        x=Mul(x,x);
    }
    return z;
}
poly f0,f1,f2,g0,g1,g2;
int n,F[N+10];
namespace conv {
    int rev[N+10],wx[N+10],lst=1;
    void Pre(int n) {
        rev[0]=0;
        for (int i=1;i<n;i++)
            if (i&1) rev[i]=rev[i^1]+(n>>1);
            else rev[i]=rev[i>>1]>>1;
        for (;lst<n;lst<<=1) {
            int wn=Pow(gx,(mo-1)/(lst<<1));
            for (int i=lst,w=1;i<(lst<<1);i++,w=Mul(w,wn)) wx[i]=w;
        }
    }
    void Dft(int *a,int n) {
        Pre(n);
        for (int i=0;i<n;i++)
            if (rev[i]<i) swap(a[i],a[rev[i]]);
        for (int i=2;i<=n;i<<=1)
            for (int j=0;j<n;j+=i) {
                int *l=a+j,*r=a+j+i/2,*now=wx+i/2;
                for (int k=0;k<i/2;k++,l++,r++,now++) {
                    int va=*l,nowx=Mul(*r,*now);
                    *l=Sum(va,nowx);
                    *r=Sub(va,nowx);
                }
            }
    }
    void Idft(int *a,int n) {
        Dft(a,n);
        reverse(a+1,a+n);
        int invn=Pow(n,mo-2);
        for (int i=0;i<n;i++) a[i]=Mul(a[i],invn);
    }
}
namespace polys {
    int ax[N+10],bx[N+10];
    poly operator + (poly p,poly q) {
        int sz=max(p.size(),q.size());
        p.resize(sz);
        for (int i=0;i<sz;i++)
            if (i<(int)q.size()) p[i]=Sum(p[i],q[i]);
        return p;
    }
    poly operator + (poly p,int x) {
        p[0]=Sum(p[0],x);
        return p;
    }
    poly operator - (poly p,poly q) {
        int sz=max(p.size(),q.size());
        p.resize(sz);
        for (int i=0;i<sz;i++)
            if (i<(int)q.size()) p[i]=Sub(p[i],q[i]);
        return p;
    }
    poly operator * (poly p,int x) {
        for (int i=0;i<(int)p.size();i++)
            p[i]=Mul(p[i],x);
        return p;
    }
    poly operator * (poly p,poly q) {
        int sz=p.size()+q.size()-1;
        int nx=1;
        while (nx<sz) nx<<=1;
        for (int i=0;i<nx;i++) ax[i]=bx[i]=0;
        for (int i=0;i<(int)p.size();i++) ax[i]=p[i];
        for (int i=0;i<(int)q.size();i++) bx[i]=q[i];
        conv::Dft(ax,nx);
        conv::Dft(bx,nx);
        for (int i=0;i<nx;i++) ax[i]=Mul(ax[i],bx[i]);
        conv::Idft(ax,nx);
        p.clear();
        for (int i=0;i<sz;i++) p.push_back(ax[i]);
        return p;
    }
    poly Make(int x) {
        poly now;
        now.clear();
        now.push_back(x);
        return now;
    }
}
using namespace polys;
const int SZ=2;
int nowa[SZ][SZ][N+10],nowb[SZ][SZ][N+10],nowc[SZ][SZ][N+10];
struct matrix {
    poly a[SZ][SZ];
    matrix operator * (matrix p) {
        matrix ans;
        int nx=1;
        while (nx<=n*2) nx<<=1;
        for (int i=0;i<SZ;i++)
            for (int j=0;j<SZ;j++)
                for (int k=0;k<nx;k++) {
                    nowa[i][j][k]=nowb[i][j][k]=nowc[i][j][k]=0;
                    if (k<(int)a[i][j].size()) nowa[i][j][k]=a[i][j][k];
                    if (k<(int)p.a[i][j].size()) nowb[i][j][k]=p.a[i][j][k];
                }
        for (int i=0;i<SZ;i++)
            for (int j=0;j<SZ;j++) {
                conv::Dft(nowa[i][j],nx);
                conv::Dft(nowb[i][j],nx);
            }
        for (int i=0;i<SZ;i++)
            for (int j=0;j<SZ;j++)
                for (int k=0;k<SZ;k++)
                    for (int k2=0;k2<nx;k2++)
                        nowc[i][k][k2]=Sum(nowc[i][k][k2],Mul(nowa[i][j][k2],nowb[j][k][k2]));
        for (int i=0;i<SZ;i++)
            for (int j=0;j<SZ;j++)
                conv::Idft(nowc[i][j],nx);
        for (int i=0;i<SZ;i++)
            for (int j=0;j<SZ;j++) {
                ans.a[i][j].clear();
                for (int k=0;k<=n;k++)
                    ans.a[i][j].push_back(nowc[i][j][k]);
            }
        return ans;
    }
    matrix operator + (matrix p) {
        for (int i=0;i<SZ;i++)
            for (int j=0;j<SZ;j++)
                p.a[i][j]=p.a[i][j]+a[i][j];
        return p;
    }
}trans,vv,v,I,nowx;
void Mpow(int y) {
    if (y==1) {
        vv=nowx=trans;
        return;
    }
    Mpow(y/2);
    vv=vv*nowx+vv;
    nowx=nowx*nowx;
    if (y&1) {
        nowx=nowx*trans;
        vv=vv+nowx;
    }
}
void Prework() {
    F[0]=F[2]=1;
    F[1]=F[3]=0;
    for (int i=4;i<=N;i++)
        F[i]=Sum(F[i-2],F[i-4]);
    f0.clear();
    f1.clear();
    f2.clear();
    f0.push_back(0);
    for (int i=0;i<=n-1;i++)
        f0.push_back(Mul(Mul(i,i),F[i]));
    f1.push_back(0);
    f1.push_back(0);
    for (int i=0;i<=n-2;i++)
        f1.push_back(Mul(Mul(i+1,i+1),F[i]));
    f2.push_back(0);
    f2.push_back(0);
    f2.push_back(0);
    for (int i=0;i<=n-3;i++)
        f2.push_back(Mul(Mul(i+2,i+2),F[i]));
    g0.clear();
    g1.clear();
    g2.clear();
    g0.push_back(0);
    for (int i=0;i<=n-1;i++)
        g0.push_back(Mul(Mul(i,i),Mul(i+1,F[i])));
    g1.push_back(0);
    g1.push_back(0);
    for (int i=0;i<=n-2;i++)
        g1.push_back(Mul(Mul(Mul(i+1,i+1),i+2),F[i]));
    g2.push_back(0);
    g2.push_back(0);
    g2.push_back(0);
    for (int i=0;i<=n-3;i++)
        g2.push_back(Mul(Mul(Mul(i+2,i+2),i+3),F[i]));
    trans.a[0][0]=f0;
    trans.a[1][0]=trans.a[0][1]=f1;
    trans.a[1][1]=f2;
    Mpow(n-1);
}
int Solve1() {
    int ans=g0[n];
    v.a[1][0]=v.a[1][1]=Make(0);
    v.a[0][0]=g0;
    v.a[0][1]=g1;
    v=v*vv;
    ans=Sum(ans,v.a[0][0][n]);
    return ans;
}
int Solve2() {
    int ans=g2[n];
    v.a[1][0]=v.a[1][1]=Make(0);
    v.a[0][0]=g1;
    v.a[0][1]=g2;
    v=v*vv;
    ans=Sum(ans,v.a[0][1][n]);
    return ans;
}
int main() {
    I.a[0][0]=I.a[1][1]=Make(1);
    I.a[1][0]=I.a[0][1]=Make(0);
    scanf("%d",&n);
    Prework();
    int ans=Solve1();
    ans=Sum(ans,Solve2());
    printf("%d\n",ans);
    return 0;
}

// They can't break me, as long as I know who I am...

#include<bits/stdc++.h>

#define F first
#define S second
#define PB push_back
#define sz(s) int((s).size())
#define bit(n,k) (((n)>>(k))&1)

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int mod = (119<<23) + 1, Lg = 17, maxn = (1<<Lg) + 10;

int dp[maxn][2][2], f[maxn], sm[maxn];

void mkay(int &a, int b){
    a = (a + b) %mod;
}

int arr[Lg][2][2][2][2 * maxn];
int frs[2][2 * maxn], sec[2][2][2 * maxn];
int w[2][2 * maxn];

int Pow(int a, int b){
    int ans = 1;
    for(; b; b>>=1, a = 1ll * a * a %mod)
	if(b&1)
	    ans = 1ll * ans * a %mod;
    return ans;
}

void fft(int *arr, int lg, bool rv){
    w[0][0] = 1;
    w[0][1] = Pow(3, 119<<(23 - lg));
    int n = 1<<lg;
    for(int i = 2; i < n; i++)
	w[0][i] = 1ll * w[0][i-1] * w[0][1] %mod;
    w[1][0] = 1;
    for(int i = 1; i < n; i++)
	w[1][i] = w[0][n-i];
    for(int i = 0; i < n; i++){
	int x = 0;
	for(int j = 0; j < lg; j++)
	    x+= bit(i,j) << (lg-1-j);
	if(x < i)
	    swap(arr[x], arr[i]);
    }
    for(int stp = 0; stp < lg; stp++){
	int stpl = 1<<stp;
	for(int l = 0; l < n; l+= stpl*2){
	    for(int i = 0; i < stpl; i++){
		int &A = arr[l + i], &B = arr[l + i + stpl], C = 1ll * w[rv][i << (lg-1-stp)] * B %mod;
		B = (A - C) %mod;
		A = (A + C) %mod;
	    }
	}
    }
    if(rv){
	int r = Pow( 1<<lg, mod-2 );
	for(int i = 0; i < n; i++)
	    arr[i] = 1ll * arr[i] * r %mod;
    }
}

void calc(int l = 0, int r = 1<<(Lg-1)){// (]
    if(r-l == 1){
	int SZ = 0;
	for(int i = 0; i < Lg; i++){
	    if(bit(r-1, i)){
		SZ += 1<<i;
		for(int m1 : {0,1})
		    for(int m2 : {0,1})
			mkay( dp[r][m1][m2], arr[i][m1][m2][r & 1][SZ-1] );
	    }
	}
    }
    else{
	int mid = (l+r) >> 1;
	calc(l, mid), calc(mid, r);
    }
    int id = __builtin_ctz(r-l);

    for(int x = 0; x < (1<<(id+1)); x++){
	frs[0][x] = x == 0 ? 0 : 1ll * x * x %mod * f[(x/2)] %mod;
	frs[1][x] = x == 0 ? 0 : 1ll * x * x %mod * f[(x/2)-(!(x&1))] %mod;
	for(int m2 : {0,1}){
	    sec[0][m2][x] = x >= (1<<id) ? 0 : dp[x + l + 1][(0 ^ x ^ l) &1][m2];
	    sec[1][m2][x] = x >= (1<<id) ? 0 : dp[x + l + 1][(1 ^ x ^ l) &1][m2];
	}
    }

    fft(frs[0], id+1, 0);
    fft(frs[1], id+1, 0);
    fft(sec[0][0], id+1, 0);
    fft(sec[1][0], id+1, 0);
    fft(sec[0][1], id+1, 0);
    fft(sec[1][1], id+1, 0);

    for(int m1 : {0,1})
	for(int m2 : {0,1})
	    for(int no : {0,1}){
		for(int x = 0; x < (1<<(id+1)); x++)
		    arr[id][m1][m2][no][x] = 1ll * frs[m1][x] * sec[m1 ^ no][m2][x] %mod;
		fft(arr[id][m1][m2][no], id+1, 1);
	    }
}

int main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie();

    int n;
    cin >> n;

    f[0] = f[1] = 1;
    for(int i = 2; i <= n; i++)
	f[i] = (f[i-1] + f[i-2]) %mod;
    for(int i = 1; i <= (1<<Lg); i++){
	if(i & 1)
	    dp[i][0][1] = dp[i][1][0] = 1ll * i * i %mod * f[i/2] %mod;
	else
	    dp[i][0][0] = 1ll * i * i %mod * f[i/2] %mod, dp[i][1][1] = 1ll * i * i %mod * f[(i/2)-1] %mod;
    }
    calc();
    for(int j = 1; j < n-1; j++){
	if(j&1)
	    mkay( sm[j], 1ll * j * j %mod * f[j/2] %mod * dp[n-1-j-1][1][0] %mod ), mkay( sm[j], 1ll * j * j %mod * f[j/2] %mod * dp[n-1-j-1][0][1] %mod );
	else
	    mkay( sm[j], 1ll * j * j %mod * f[j/2] %mod * dp[n-1-j-1][0][0] %mod ), mkay( sm[j], 1ll * j * j %mod * f[(j/2)-1] %mod * dp[n-1-j-1][1][1] %mod );
    }
    for(int j = n-2; j >= 0; j--){
	mkay( sm[j], sm[j+1] );
    }
    int ans = 0;
    for(int i = 0; i < n; i++)
	mkay(ans, sm[i]);
    if(n&1)
	mkay(ans, 1ll * n * (n-1) %mod * (n-1) %mod * (f[n/2] + f[(n/2)-1]) %mod);
    if(ans < 0)
	ans+= mod;
    return cout << ans << endl,0;
}
// #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cstdlib>
using namespace std;
#define N 50010
#define L (1<<19)+10
#define mod 998244353
#define RG register
#define LL long long
int n,g[N],f0[N],f1[N],f2[N],pf[N];
inline int quick_mod(int di,int mi)
{
	RG int ret=1;
	for(;mi;mi>>=1,di=(LL)di*di%mod)
		if(mi&1)ret=(LL)ret*di%mod;
	return ret;
}
int poww[L],rev[L],bin[25],logi[L],inv[L],len=1;
inline void dft(int *a,int ra,int opt)
{
	RG int i,j,d=logi[len]-logi[ra],l,tmp,wn,*w,*x,*y;
	for(i=0;i<ra;++i)if(i<(rev[i]>>d))swap(a[i],a[rev[i]>>d]);
	for(d=2;d<=ra;d<<=1)
		for(i=0,l=(d>>1),wn=(opt==1?(len/d):(-len/d));i<ra;i+=d)
			for(j=0,x=a+i,y=x+l,w=poww+((opt==1)?0:len);j<l;++j,++x,++y,w+=wn)
				tmp=(LL)(*w)*(*y)%mod,*y=(*x+mod-tmp)%mod,*x=(*x+tmp)%mod;
	if(opt==-1)
		for(i=0;i<ra;++i)a[i]=(LL)a[i]*inv[ra]%mod;
}
int tmp1[L],tmp2[L];
inline int solve1(int l,int r)
{
	if(l==r)return 1;
	RG int i,mi=l+r>>1,ra=r-l+1,la=1,r1=solve1(l,mi);
	while(la<(ra+r1))la<<=1;
	for(i=0;i<r1;++i)tmp1[i]=f0[l+i];
	memset(tmp1+r1,0,la-r1<<2);dft(tmp1,la,1);
	for(i=0;i<ra;++i)tmp2[i]=(LL)g[i]*pf[i]%mod;
	memset(tmp2+ra,0,la-ra<<2);dft(tmp2,la,1);
	for(i=0;i<la;++i)tmp2[i]=(LL)tmp2[i]*tmp1[i]%mod;
	dft(tmp2,la,-1);
	for(i=mi+1;i<=r;++i)f0[i]=(f0[i]+tmp2[i-l-1])%mod;
	for(i=0;i<ra;++i)tmp2[i]=(LL)g[i]*pf[i+1]%mod;
	memset(tmp2+ra,0,la-ra<<2);dft(tmp2,la,1);
	for(i=0;i<la;++i)tmp1[i]=(LL)tmp2[i]*tmp1[i]%mod;
	dft(tmp1,la,-1);
	for(i=mi+1;i<=r;++i)f1[i]=(f1[i]+tmp1[i-1-l])%mod;
	for(i=0;i<r1;++i)tmp1[i]=f1[l+i];
	memset(tmp1+r1,0,la-r1<<2);dft(tmp1,la,1);
	for(i=0;i<la;++i)tmp2[i]=(LL)tmp2[i]*tmp1[i]%mod;
	dft(tmp2,la,-1);
	for(i=mi+1;i<=r;++i)if(i-l-3>=0)f0[i]=(f0[i]+tmp2[i-l-3])%mod;
	for(i=mi+1;i<=r;++i)f2[i]=(f2[i]+tmp2[i-1-l])%mod;
	for(i=0;i<ra;++i)tmp2[i]=(LL)g[i]*pf[i+2]%mod;
	memset(tmp2+ra,0,la-ra<<2);dft(tmp2,la,1);
	for(i=0;i<la;++i)tmp1[i]=(LL)tmp2[i]*tmp1[i]%mod;
	dft(tmp1,la,-1);
	for(i=mi+1;i<=r;++i)if(i-l-3>=0)f1[i]=(f1[i]+tmp1[i-l-3])%mod;
	for(i=0;i<r1;++i)tmp1[i]=f2[l+i];
	memset(tmp1+r1,0,la-r1<<2);dft(tmp1,la,1);
	for(i=0;i<la;++i)tmp2[i]=(LL)tmp2[i]*tmp1[i]%mod;
	dft(tmp2,la,-1);
	for(i=mi+1;i<=r;++i)if(i-l-3>=0)f2[i]=(f2[i]+tmp2[i-l-3])%mod;
	solve1(mi+1,r);
	return ra;
}
signed main()
{
	RG int i;
	scanf("%d",&n);while(len<(n<<2))len<<=1;
	for(bin[0]=i=1;i<=20;++i)bin[i]=bin[i-1]<<1;
	for(i=0;i<=18;++i)logi[bin[i]]=i;
	for(inv[2]=((mod+1)>>1),i=2;i<=18;++i)inv[bin[i]]=(LL)inv[bin[i-1]]*inv[2]%mod;
	for(i=0;i<len;++i)
		if(i&1)rev[i]=(rev[i>>1]>>1)|(len>>1);
		else rev[i]=rev[i>>1]>>1;
	poww[0]=poww[len]=1,poww[1]=quick_mod(3,(mod-1)/len);
	for(i=2;i<len;++i)poww[i]=(LL)poww[i-1]*poww[1]%mod;
	for(i=1;i<=n+2;++i)pf[i]=(LL)i*i%mod;
	g[0]=1,g[1]=0,g[2]=1,g[3]=0;
	for(i=4;i<=n;i+=2)g[i]=(g[i-2]+g[i-4])%mod;
	f0[0]=0,f1[0]=1,f2[0]=4;
	for(i=1;i<=n;++i)
		{f0[i]=(LL)g[i]*pf[i]%mod;f1[i]=(LL)g[i]*pf[i+1]%mod;f2[i]=(LL)g[i]*pf[i+2]%mod;}
	solve1(0,n);
	RG int ans=(LL)(g[n-1]+g[n-3])*pf[n-1]%mod*n%mod;
	for(i=3;i<n;++i)ans=(ans+(LL)g[i-2]*pf[i-2]%mod*f0[n-i]%mod*(i-1))%mod;
	for(i=3;i<n;++i)ans=(ans+(LL)2*g[i-3]*pf[i-2]%mod*f1[n-i-1]%mod*(i-1))%mod;
	for(i=4;i<=n-2;++i)ans=(ans+(LL)g[i-4]*pf[i-2]%mod*f2[n-i-2]%mod*(i-1))%mod;
	printf("%d\n",ans);
}

#include<cstdio>
#include<algorithm>
using std::swap;
using std::max;
#define maxn 65536
typedef long long ll;

const int mod=998244353,wg=3,ig=332748118;
int r[maxn],a[maxn],b[maxn],squre[50002],f0[50000],f1[50000],f2[50000];
int g[50002]={1,0,1,0},g0[50000],g1[50000],g2[50000];
int *w,len,inv,wn[maxn]={1},iwn[maxn]={1};
int pow(int x,int p)
{
    int res(1);
    while(p)
    {
        if(p&1) res=1ll*res*x%mod;
        x=1ll*x*x%mod;
        p>>=1;
    }
    return res;
}
void ntt(int* t,int* ow=wn)
{
    for(int i(0);i<len;++i)
    {
        if(i<r[i]) swap(t[i],t[r[i]]);
    }
    for(int i(1),j(2),step(len>>1);i<len;i<<=1,j<<=1,step>>=1)
    {
        for(int k(0);k<len;k+=j)
        {
            w=ow;
            for(int l(k);l<k+i;++l,w+=step)
            {
                int tmp(1ll*(*w)*t[l+i]%mod);
                t[l+i]=t[l]-tmp;
                if(t[l+i]<0) t[l+i]+=mod;
                t[l]+=tmp;
                if(t[l]>=mod) t[l]-=mod;
            }
        }
    }
    if(ow==iwn)
    {
        for(int i(0);i<len;++i) t[i]=1ll*t[i]*inv%mod;
    }
}
void get_f(int lo,int hi)
{
    if(hi==lo+1)
    {
        f0[lo]=(f0[lo]+g0[lo])%mod;
        f1[lo]=(f1[lo]+g1[lo])%mod;
        f2[lo]=(f2[lo]+g2[lo])%mod;
    }
    else
    {
        int mi((lo+hi)>>1);
        get_f(lo,mi);
        int tmp(hi-lo),ti(max(lo+3,mi));len=1;
        while(len<=tmp) len<<=1;
        inv=mod-(mod-1)/len;
        for(int i(0);i<len;++i) r[i]=(r[i>>1]|((i&1)?len:0))>>1;
        for(int i(1),j(pow(wg,(mod-1)/len));i<len;++i) wn[i]=1ll*wn[i-1]*j%mod;
        for(int i(1),j(pow(ig,(mod-1)/len));i<len;++i) iwn[i]=1ll*iwn[i-1]*j%mod;
        for(int i(0);i<=tmp-2;++i) a[i]=g0[i];
        for(int i(lo);i<mi;++i) b[i-lo]=f0[i];
        ntt(a);ntt(b);
        for(int i(0);i<len;++i) a[i]=1ll*a[i]*b[i]%mod;
        ntt(a,iwn);
        for(int i(mi);i<hi;++i) f0[i]=(f0[i]+a[i-1-lo])%mod;
        for(int i(0);i<=tmp-2;++i) a[i]=g1[i];
        for(int i(tmp-1);i<len;++i) a[i]=0;
        ntt(a);for(int i(0);i<len;++i) b[i]=1ll*a[i]*b[i]%mod;
        ntt(b,iwn);
        for(int i(mi);i<hi;++i) f1[i]=(f1[i]+b[i-1-lo])%mod;
        for(int i(lo);i<mi;++i) b[i-lo]=f1[i];
        for(int i(mi-lo);i<len;++i) b[i]=0;
        ntt(b);
        for(int i(0);i<len;++i) a[i]=1ll*a[i]*b[i]%mod;
        ntt(a,iwn);
        for(int i(mi);i<hi;++i) f2[i]=(f2[i]+a[i-1-lo])%mod;
        for(int i(ti);i<hi;++i) f0[i]=(f0[i]+a[i-3-lo])%mod;
        for(int i(0);i<=tmp-2;++i) a[i]=g2[i];
        for(int i(tmp-1);i<len;++i) a[i]=0;
        ntt(a);
        for(int i(0);i<len;++i) b[i]=1ll*a[i]*b[i]%mod;
        ntt(b,iwn);
        for(int i(ti);i<hi;++i) f1[i]=(f1[i]+b[i-3-lo])%mod;
        for(int i(lo);i<mi;++i) b[i-lo]=f2[i];
        for(int i(mi-lo);i<len;++i) b[i]=0;
        ntt(b);
        for(int i(0);i<len;++i) a[i]=1ll*a[i]*b[i]%mod;
        ntt(a,iwn);
        for(int i(ti);i<hi;++i) f2[i]=(f2[i]+a[i-3-lo])%mod;
        for(int i(0);i<len;++i) a[i]=b[i]=0;
        get_f(mi,hi);
    }
}
int main()
{
    int n,ans;scanf("%d",&n);
    for(int i(4);i<=n+1;++i) g[i]=(g[i-2]+g[i-4])%mod;
    for(int i(0);i<=n+1;++i) squre[i]=1ll*i*i%mod;
    for(int i(0);i<n;++i)
    {
        g0[i]=1ll*g[i]*squre[i]%mod;
        g1[i]=1ll*g[i]*squre[i+1]%mod;
        g2[i]=1ll*g[i]*squre[i+2]%mod;
    }
    get_f(0,n);
    ans=1ll*g[n+1]*squre[n-1]%mod*n%mod;
    for(int i(2);i<=n-2;++i)
        ans=(1ll*i*squre[i-1]%mod*((1ll*g[i-1]*f0[n-1-i]+1ll*2*g[i-2]*f1[n-i-2])%mod)+ans)%mod;
    for(int i(3);i<=n-3;++i)
        ans=(1ll*i*squre[i-1]%mod*g[i-3]%mod*f2[n-i-3]+ans)%mod;
    printf("%d",ans);
    return 0;
}

#include<cstdio>
#include<algorithm>
using namespace std;const int N=1e5+10;const int S=40;
typedef unsigned long long ll;const ll mod=998244353;
struct poly
{
	int a[S+10];
	inline int& operator [](const int & x){return a[x];}
	poly(){for(int i=0;i<S;i++)a[i]=0;}
	friend poly operator * (poly a,poly b)
	{
		poly c;for(int i=0;i<S;i++)
			for(int j=0;j<S&&i+j<S;j++)c[i+j]+=a[i]*b[j];return c;
	}
	friend poly operator +(poly a,poly b){poly c;for(int i=0;i<S;i++)c[i]=a[i]+b[i];return c;}
	friend poly operator -(poly a,poly b){poly c;for(int i=0;i<S;i++)c[i]=a[i]-b[i];return c;}
	poly operator <<(const int& x){poly c;for(int i=S-1;i>=x;i--)c[i]=a[i-x];return c;}
}a,b,c,q,fz,fm,fz1,fm1;int n;
ll f0[N];ll c0[N];ll f1[N];ll c1[N];ll f2[N];ll c2[N];ll g[N];ll sqr[N];
inline void calc(poly& fz,poly& fm,ll* f,ll* c)
{
	for(int i=0;i<S;i++)f[i]=(mod+fz[i])%mod;
	for(int i=0;i<S;i++)c[i]=(mod-fm[i])%mod;(c[0]+=1)%=mod;
	for(int i=0;i<=n;i++)
		for(int j=1;j<S&&j<=i;j++)(f[i]+=f[i-j]*c[j])%=mod;
}
int main()
{
	a[8]=16;a[6]=12;a[4]=20;a[2]=4;b[8]=9;b[6]=2;b[4]=23;b[2]=6;b[0]=1;
	c[8]=4;c[6]=-4;c[4]=24;c[2]=4;c[0]=4;q[12]=-1;q[10]=-3;q[6]=+5;q[2]=-3;q[0]=+1;
	scanf("%d",&n);
	fz=((b*b)<<3)-a*((c<<3)-q);fm=((c<<3)-q)*((a<<1)-q)-((b*b)<<4);calc(fz,fm,f0,c0);
	fz=b*q;fm=((c<<3)-q)*((a<<1)-q)-((b*b)<<4);calc(fz,fm,f1,c1);
	fz1=c*fm+((b*fz)<<1);fm1=fm*(q-(c<<3));calc(fz1,fm1,f2,c2);
	g[0]=1;g[2]=1;for(int i=4;i<=n;i++)g[i]=(g[i-2]+g[i-4])%mod;
	for(int i=1;i<=n;i++)sqr[i]=(ll)i*i%mod;
	ll ans=(g[n-1]+g[n-3])*sqr[n-1]%mod*n%mod;
	for(int i=2;i<=n-2;i++)
	{
		ll ret=0;(ret+=g[i-1]*f0[n-i-1])%=mod;(ret+=g[i-2]*f1[n-i-2]*2)%=mod;
		if(3<=i&&i<=n-3)(ret+=g[i-3]*f2[n-i-3])%=mod;
		(ans+=ret*sqr[i-1]%mod*i)%=mod;
	}printf("%I64d",ans);
}

#include<bits/stdc++.h>
using namespace std;
const int N=1<<20;
const int mod=998244353;
int n,g[N],f[3][N],all,res;
//g:the number of partitions when there is no separating point
//f0:the number of partitions that there could be separating points, and there is no matched places on either border
//f1:there is exact one matched place on one border
//f2:there're matched places on both borders
const int G=3;
int rev[N];
int ksm(int x,int y){
	int rt=1;
	for(;y;x=(1ll*x*x)%mod,y>>=1)if(y&1)rt=(1ll*rt*x)%mod;
	return rt;
}
void NTT(int *a,int tp,int LG){
	int lim=(1<<LG),invlim=ksm(lim,mod-2);
	for(int i=0;i<lim;i++)rev[i]=(rev[i>>1]>>1)|((i&1)<<(LG-1));
	for(int i=0;i<lim;i++)if(i<rev[i])swap(a[i],a[rev[i]]);
	for(int md=1;md<lim;md<<=1){
		int rt=ksm(G,(mod-1)/(md<<1));
		if(tp==-1)rt=ksm(rt,mod-2);
		for(int stp=md<<1,pos=0;pos<lim;pos+=stp){
			int w=1;
			for(int i=0;i<md;i++,w=(1ll*w*rt)%mod){
				int x=a[pos+i],y=(1ll*w*a[pos+md+i])%mod;
				a[pos+i]=(x+y)%mod;
				a[pos+md+i]=(x-y+mod)%mod;
			}
		}
	}
	if(tp==-1)for(int i=0;i<lim;i++)a[i]=(1ll*a[i]*invlim)%mod;
}
#define sqr(x) 1ll*(x)*(x)%mod
void ADD(int &x,int y){x+=y;if(x>=mod)x-=mod;}
int A[N],B[N];
void CDQ(int l,int LG){
	if(!LG){ADD(f[0][l],sqr(l)*g[l]%mod),ADD(f[1][l],sqr(l+1)*g[l]%mod),ADD(f[2][l],sqr(l+2)*g[l]%mod);return;}
	CDQ(l,LG-1);
	int lim=(1<<LG);
//----------------------0------------------------------
	for(int i=0;i<(lim<<1);i++)A[i]=B[i]=0;
	for(int i=0;i<lim;i++)A[i]=sqr(i)*g[i]%mod;
	for(int i=0;i<(lim>>1);i++)B[i]=f[0][l+i];
	NTT(A,1,LG+1),NTT(B,1,LG+1);
	for(int i=0;i<(lim<<1);i++)A[i]=1ll*A[i]*B[i]%mod;
	NTT(A,-1,LG+1);
	for(int i=(lim>>1);i<lim;i++)if(i-1>=0)ADD(f[0][l+i],A[i-1]);

	for(int i=0;i<(lim<<1);i++)A[i]=B[i]=0;
	for(int i=0;i<lim;i++)A[i]=sqr(i+1)*g[i]%mod;
	for(int i=0;i<(lim>>1);i++)B[i]=f[1][l+i];
	NTT(A,1,LG+1),NTT(B,1,LG+1);
	for(int i=0;i<(lim<<1);i++)A[i]=1ll*A[i]*B[i]%mod;
	NTT(A,-1,LG+1);
	for(int i=(lim>>1);i<lim;i++)if(i-3>=0)ADD(f[0][l+i],A[i-3]);
//----------------------1------------------------------
	for(int i=0;i<(lim<<1);i++)A[i]=B[i]=0;
	for(int i=0;i<lim;i++)A[i]=sqr(i+1)*g[i]%mod;
	for(int i=0;i<(lim>>1);i++)B[i]=f[0][l+i];
	NTT(A,1,LG+1),NTT(B,1,LG+1);
	for(int i=0;i<(lim<<1);i++)A[i]=1ll*A[i]*B[i]%mod;
	NTT(A,-1,LG+1);
	for(int i=(lim>>1);i<lim;i++)if(i-1>=0)ADD(f[1][l+i],A[i-1]);

	for(int i=0;i<(lim<<1);i++)A[i]=B[i]=0;
	for(int i=0;i<lim;i++)A[i]=sqr(i+2)*g[i]%mod;
	for(int i=0;i<(lim>>1);i++)B[i]=f[1][l+i];
	NTT(A,1,LG+1),NTT(B,1,LG+1);
	for(int i=0;i<(lim<<1);i++)A[i]=1ll*A[i]*B[i]%mod;
	NTT(A,-1,LG+1);
	for(int i=(lim>>1);i<lim;i++)if(i-3>=0)ADD(f[1][l+i],A[i-3]);
//----------------------2------------------------------
	for(int i=0;i<(lim<<1);i++)A[i]=B[i]=0;
	for(int i=0;i<lim;i++)A[i]=sqr(i+1)*g[i]%mod;
	for(int i=0;i<(lim>>1);i++)B[i]=f[1][l+i];
	NTT(A,1,LG+1),NTT(B,1,LG+1);
	for(int i=0;i<(lim<<1);i++)A[i]=1ll*A[i]*B[i]%mod;
	NTT(A,-1,LG+1);
	for(int i=(lim>>1);i<lim;i++)if(i-1>=0)ADD(f[2][l+i],A[i-1]);

	for(int i=0;i<(lim<<1);i++)A[i]=B[i]=0;
	for(int i=0;i<lim;i++)A[i]=sqr(i+2)*g[i]%mod;
	for(int i=0;i<(lim>>1);i++)B[i]=f[2][l+i];
	NTT(A,1,LG+1),NTT(B,1,LG+1);
	for(int i=0;i<(lim<<1);i++)A[i]=1ll*A[i]*B[i]%mod;
	NTT(A,-1,LG+1);
	for(int i=(lim>>1);i<lim;i++)if(i-3>=0)ADD(f[2][l+i],A[i-3]);

	CDQ(l+(lim>>1),LG-1);
}
int main(){
	scanf("%d",&n);
	while((1<<all)<=n)all++;
	g[0]=g[2]=1,g[1]=g[3]=0;
	for(int i=4;i<(1<<all);i++)g[i]=(g[i-2]+g[i-4])%mod;
	CDQ(0,all);
	res=sqr(n-1)*n%mod*(g[n-1]+g[n-3])%mod;
	for(int i=0;i<n;i++){
		if(i-1>=0&&n-i-1>=0)ADD(res,sqr(i-1)*i%mod*g[i-1]%mod*f[0][n-i-1]%mod);
		if(i-2>=0&&n-i-2>=0)ADD(res,2*sqr(i-1)*i%mod*g[i-2]%mod*f[1][n-i-2]%mod);
		if(i-3>=0&&n-i-3>=0)ADD(res,sqr(i-1)*i%mod*g[i-3]%mod*f[2][n-i-3]%mod);
	}
	printf("%d\n",res);
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define ref(i,x,y)for(int i=x;i<=y;++i)
#define def(i,x,y)for(int i=x;i>=y;--i)
#define SZ(x) ((int)x.size())
#define pb push_back
typedef long long LL;
const int mod=998244353;
const int N=1<<20;
int mul(int a,int b){ return (LL)a*b%mod; }
void inc(int&a,int b){ a+=b;if(a>=mod)a-=mod; }
void dec(int&a,int b){ a-=b;if(a<0)a+=mod; }
int mi(int a,int b){
	int s=1;
	for(;b;b>>=1,a=(LL)a*a%mod)
		if(b&1)s=(LL)s*a%mod;
	return s;
}
namespace fft{
	int rev[N];
	int getup(int L){
		int x=1;for(;x<L;x<<=1);return x;
	}
	void initrev(int L){
		ref(i,1,L-1)rev[i]=rev[i>>1]>>1|((i&1)?(L>>1):0);
	}
	void print(vector<int> a,int L=-1){
		if(L<0)L=SZ(a);
		ref(i,0,L-1)cout<<a[i]<<" ";cout<<endl;
	}
	void fft(vector<int>&a,int tp){
		int L=SZ(a);
		ref(i,1,L-1)if(rev[i]<i)swap(a[i],a[rev[i]]);
		for(int i=2;i<=L;i<<=1){
			int I=i>>1,w=mi(3,(mod-1)/i);
			if(tp<0)w=mi(w,mod-2);
			for(int j=0;j<L;j+=i)
			for(int k=j,W=1;k<j+I;++k,W=mul(W,w)){
				int A=a[k],B=mul(a[k+I],W);
				a[k]=A;inc(a[k],B);
				a[k+I]=A;dec(a[k+I],B);
			}
		}
		if(tp<0){
			int w=mi(L,mod-2);
			ref(i,0,L-1)a[i]=mul(a[i],w);
		}
	}
	void inc(vector<int>&a,vector<int> b){
		int L=SZ(a);
		if(SZ(b)>L)L=SZ(b),a.resize(L);
		ref(i,0,SZ(b)-1)if((a[i]+=b[i])>=mod)a[i]-=mod;
	}
	void dec(vector<int>&a,vector<int> b){
		int L=SZ(a);
		if(SZ(b)>L)L=SZ(b),a.resize(L);
		ref(i,0,SZ(b)-1)if((a[i]-=b[i])<0)a[i]+=mod;
	}
	vector<int> mul(vector<int> a,vector<int> b,int tp=0){
		int l=SZ(a)+SZ(b)-1;
		int L=getup(l);
		initrev(L);
		a.resize(L);b.resize(L);
		fft(a,1);if(tp)b=a;else fft(b,1);
		ref(i,0,L-1)a[i]=(LL)a[i]*b[i]%mod;
		fft(a,-1);
		a.resize(l);
		return a;
	}
	vector<int> moveR(vector<int> a,int x){
		int L=SZ(a);
		a.resize(L+=x);
		def(i,L-1,x)a[i]=a[i-x];
		ref(i,0,x-1)a[i]=0;
		return a;
	}
	vector<int> getni(vector<int> a,int x){
		vector<int> s,S;s.resize(1);
		s[0]=mi(a[0],mod-2);
		for(int L=1;L<x;L<<=1){
			S=mul(a,mul(s,s,1));
			S.resize(L<<1);
			ref(i,0,L-1)(s[i]*=2)%=mod;
			dec(s,S);
			s.resize(L<<1);
		}
		return s;
	}
}
using namespace fft;
vector<int> A0,A1,A2,A3,A4,B2,B3,C1,C2,D;
int n,ans;
void initA(){
	A0.clear();A0.resize(n);
	A0[0]=1;A0[2]=1;
	for(int i=4;i<n;i+=2)
		A0[i]=(A0[i-4]+A0[i-2])%mod;
	A1.resize(n);A2.resize(n);
	ref(i,0,n-1)A1[i]=mul(A0[i],i);
	ref(i,0,n-1)A2[i]=mul(A1[i],i);
	A3=moveR(A0,2);
	ref(i,0,SZ(A3)-1)A3[i]=mul(A3[i],mul(i,i));
	A4=moveR(A0,1);
	ref(i,0,SZ(A4)-1)A4[i]=mul(A4[i],mul(i,i));
}
void initB(vector<int>A,vector<int>&B){
	vector<int>a=moveR(A,1);
	ref(i,0,SZ(a)-1)a[i]=(mod-a[i])%mod;
	a[0]=(a[0]+1)%mod;
	B=getni(a,n);
}
void calc1(int&ans,vector<int>A,vector<int>B){
	A=moveR(A,1);
	ref(i,0,SZ(A)-1)A[i]=mul(A[i],i);
	A=mul(A,B);
	if(SZ(A)>n)inc(ans,A[n]);
}
void initC(vector<int>A){
	A=moveR(A,1);
	C1=mul(mul(A,B3),mul(A,B2));
	C1.resize(n+1);
	C2=C1;
	ref(i,0,n)C2[i]=mul(C2[i],i);
}
void initD(vector<int>A,vector<int>&B){
	ref(i,0,SZ(A)-1)A[i]=(mod-A[i])%mod;
	A[0]=(A[0]+1)%mod;
	B=getni(A,n);
}
void calc2(int&ans,vector<int>A,vector<int>B){
	vector<int>S=mul(A,B);
	if(SZ(S)>n)inc(ans,S[n]);
}
int main(){
	cin>>n;
	initA();
	initB(A2,B2);
	calc1(ans,A2,B2);
	initB(A3,B3);
	calc1(ans,A3,B3);
	initC(A4);
	initD(C1,D);
	calc2(ans,C2,D);
	cout<<ans<<endl;
}

#include<bits/stdc++.h>
#define N 400005
#define ll long long
#define P 998244353
using namespace std;
int n,h[N],g0[N],g1[N],g2[N],Ans;
int h0[N],h1[N],h2[N];
int sqr(int x){return (ll)x*x%P;}
void upd(int &x,int y){x=(x+y)%P;}
int pw(int x,int y)
{
	int ans=1;
	for (;y;x=(ll)x*x%P,y>>=1)
		if (y&1) ans=(ll)ans*x%P;
	return ans;
}
int tn,tl,r[N],rn,w[2][N],A[N],B[N],C[N];
void dft(int a[],int p)
{
	for (int i=0;i<tn;i++)
		if (r[i]>i) swap(a[r[i]],a[i]);
	for (int i=1;i<tn;i<<=1)
	for (int j=0,t=tn/(i<<1);j<tn;j+=i<<1)
	for (int k=0,l=0;k<i;k++,l+=t)
	{
		int x=(ll)w[p][l]*a[j+k+i]%P,y=a[j+k];
		a[j+k]=(y+x)%P;
		a[j+k+i]=(y-x+P)%P;
	}
	if (p)
		for (int i=0;i<tn;i++)
			a[i]=(ll)a[i]*rn%P;
}
void pre(int n)
{
	tn=1,tl=0;
	while(tn<=n) tn<<=1,tl++;
	tn<<=1;tl++;
	int W=pw(3,(P-1)/tn);
	w[0][0]=w[1][0]=1;
	for (int i=1;i<tn;i++)
		w[0][i]=w[1][tn-i]=(ll)w[0][i-1]*W%P;
	for (int i=1;i<tn;i++)
		r[i]=(r[i>>1]>>1)|((i&1)<<tl-1);
	rn=pw(tn,P-2);
}
/*
void mul(int a[],int b[],int c[],int n)
{
	for (int i=0;i<=n;i++)
		A[i]=a[i],B[i]=b[i];
	for (int i=n+1;i<tn;i++)
		A[i]=B[i]=0;
	dft(A,0);
	dft(B,0);
	for (int i=0;i<tn;i++)
		c[i]=(ll)a[i]*b[i]%P;
	dft(c,1);
}
*/
void work(int l,int r,int a[],int b[],int c[])
{
	int len=r-l+1,mid=l+r>>1;
	for (int i=l;i<=mid;i++) A[i-l]=a[i];
	for (int i=mid+1;i<=r;i++) A[i-l]=0;
	for (int i=r+1-l;i<tn;i++) A[i]=0;
	for (int i=0;i<=len;i++) B[i]=b[i];
	for (int i=len+1;i<tn;i++) B[i]=0;

	dft(A,0);dft(B,0);
	for (int i=0;i<tn;i++) C[i]=(ll)A[i]*B[i]%P;
	dft(C,1);

	/*
	for (int i=0;i<tn;i++)
	{
		C[i]=0;
		for (int j=0;j<=i;j++)
			upd(C[i],(ll)A[j]*B[i-j]%P);
	}
	*/
	for (int i=mid+1;i<=r;i++) upd(c[i],C[i-l]);
}
void solve(int l,int r)
{
	if (l==r)
	{
		upd(g0[l],(ll)h[l]*sqr(l)%P);
		upd(g1[l],(ll)h[l-1]*sqr(l)%P);
		upd(g2[l],(ll)h[l-2]*sqr(l)%P);
		return;
	}
	int mid=l+r>>1,len=r-l;
	solve(l,mid);
	pre(len);
	work(l,r,g0,h0,g0);
	work(l,r,g1,h0,g1);
	work(l,r,g1,h1,g2);
	work(l,r,g1,h1,g0);
	work(l,r,g2,h1,g1);
	work(l,r,g2,h2,g2);
	solve(mid+1,r);
}
int main()
{
	scanf("%d",&n);
	h[0]=1;
	for (int i=1;i<=n;i++)
		h[i]=((i>=2?h[i-2]:0)+(i>=4?h[i-4]:0))%P;
	for (int i=0;i<=n;i++)
	{
		h0[i+1]=(ll)h[i]*sqr(i)%P;
		h1[i+2]=(ll)h[i]*sqr(i+1)%P;
		h2[i+3]=(ll)h[i]*sqr(i+2)%P;
	}
	/*
	for (int i=0;i<=n;i++)
	{
		g0[i]+=h[i]*sqr(i);
		g1[i]+=h[i-1]*sqr(i);
		g2[i]+=h[i-2]*sqr(i);
		for (int j=0;j<=n;j++)
		{
			g0[i+j+1]+=g0[i]*h[j]*sqr(j);
			g1[i+j+1]+=g1[i]*h[j]*sqr(j);
			g2[i+j+2]+=g1[i]*h[j]*sqr(j+1);
			g0[i+j+2]+=g1[i]*h[j]*sqr(j+1);
			g1[i+j+2]+=g2[i]*h[j]*sqr(j+1);
			g2[i+j+3]+=g2[i]*h[j]*sqr(j+2);
		}
	}
	*/
	solve(0,n);
	/*
	for (int i=0;i<=n;i++)
	{
		printf("%d   %d %d %d %d\n",i,h[i],g0[i],g1[i],g2[i]);
	}
	*/
	upd(Ans,(ll)(n-1)*h[n-1]%P*sqr(n-1)%P);
	upd(Ans,(ll)(n-1)*h[n-3]%P*sqr(n-1)%P);
	upd(Ans,g0[n-1]);
	upd(Ans,g2[n-1]);
	//printf("%d\n",Ans);
	for (int i=3;i<=n;i++)
	{
		int tmp=0;
		upd(tmp,(ll)h[i-2]*g0[n-i]%P);
		upd(tmp,(ll)h[i-3]*g1[n-i]*2%P);
		if (i>=4) upd(tmp,(ll)h[i-4]*g2[n-i]%P);
		upd(Ans,(ll)(i-2)*tmp%P*sqr(i-2)%P);
	}
	printf("%d\n",Ans);
}

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define REP(i,n) for(int i=(0);i<(n);i++)
#define pb push_back
using namespace std;
typedef vector<int> vi;
typedef long long ll;

const int N=5005,mod=998244353;
namespace {
	inline int add(int x,int y){
		return x+y>=mod?x+y-mod:x+y;
	}
	inline void Add(int &x,int y){
		x=add(x,y);
	}
	inline int mnu(int x,int y){
		return x-y<0?x-y+mod:x-y;
	}
	inline int mul(int x,int y){
		return (ll)x*y%mod;
	}
	inline int power(int x,ll p){
		int res=1;
		for(;p;p>>=1,x=(ll)x*x%mod)
			if(p&1)res=(ll)res*x%mod;
		return res;
	}
	#define inv(x) power(x,mod-2)
}
namespace LS{
	/*
	note:
	所有下标均从零开始
	a[i]=\sum a[i-j-1]*r[j]
	初值为a[0]..a[sz-1]
	*/
	int p[N],d[N],m;vi s[N];
	vi BM(vi a){
		int n=a.size();
		for(;m;)s[m--].clear();
		REP(i,n){
			d[i]=a[i];
			REP(j,s[m].size())
				d[i]=mnu(d[i],mul(a[i-j-1],s[m][j]));
			if(!d[i])continue;
			p[m]=i;
			if(!m){s[++m].resize(i+1);continue;}
			int id=m-1;
			REP(j,m-1)
				id=(p[j]-s[j].size()>p[id]-s[id].size()?j:id);
			int coef=mul(d[i],inv(d[p[id]]));
			s[++m].resize(i-p[id]-1);
			s[m].pb(coef);
			REP(j,s[id].size())
				s[m].pb(mul(mod-coef,s[id][j]));
			REP(j,s[m-1].size())
				if(j<s[m].size())s[m][j]=add(s[m][j],s[m-1][j]);
				else s[m].pb(s[m-1][j]);
		}
		return s[m];
	}
	const ll Mod=(ll)mod*mod*8;
	#define fix(x) (x>=Mod?x-=Mod:0);
	int A[N],B[N],bin[N],res[N],n;
	inline void Mul(int *x,int *y){
		static ll t[N<<1];
		rep(k,0,n*2-2)t[k]=0;
		REP(i,n)REP(j,n)
			t[i+j]+=(ll)x[i]*y[j],fix(t[i+j]);
		per(i,n*2-2,n){
			t[i]%=mod;
			REP(j,n)t[i-j-1]+=t[i]*A[j],fix(t[i-j-1]);
			t[i]=0;
		}
		REP(i,n)x[i]=t[i]%mod;
	}
	int solve(vi a,vi b,ll K){
		n=a.size();
		if(K<=n-1)return b[K];
		if(n==1)return mul(b[0],power(a[0],K));
		REP(i,n){
			bin[i]=res[i]=0;
			A[i]=a[i],B[i]=b[i];
		}
		bin[1]=res[0]=1;
		for(K-=n-1;K;K>>=1,Mul(bin,bin))
			if(K&1)Mul(res,bin);
		rep(i,n,n*2-2){
			B[i]=0;
			REP(j,n)B[i]=add(B[i],mul(B[i-j-1],A[j]));
		}
		int s=0;
		REP(i,n)s=add(s,mul(B[n-1+i],res[i]));
		return s;
	}
	int gao(vi x,ll K){
	//	vi now=BM(x);
	//	for(auto k:now)
	//		printf("%d\n",k);
	//	cerr<<now.size()<<endl;
		return solve(BM(x),x,K);
	}
}

int main(){
	int n;
	while(cin>>n){
		cout<<LS::gao(
{
0,
0,
24,
4,
240,
204,
1316,
2988,
6720,
26200,
50248,
174280,
436904,
1140888,
3436404,
8348748,
24631232,
64575924,
174658944,
488230244,
282739095,
583167773,
599201163,
111178790,
470158977,
118436480,
744170002,
418128853,
620410921,
282515603,
777785540,
59207630,
823529776,
886871858,
80677633,
874800287,
754269413,
659807497,
302870971,
307001715
},
		n-1)<<endl;
	}
	return 0;
}

#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;
}

#include <bits/stdc++.h>
using namespace std;

using ll=long long;
#define int ll

#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#define si(x) int(x.size())
#ifdef LOCAL
#define dmp(x) cerr<<__LINE__<<" "<<#x<<" "<<x<<endl
#else
#define dmp(x) void(0)
#endif

template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

using pi=pair<int,int>;
using vi=vc<int>;

template<class t,class u>
ostream& operator<<(ostream& os,const pair<t,u>& p){
	return os<<"{"<<p.a<<","<<p.b<<"}";
}

template<class t> ostream& operator<<(ostream& os,const vc<t>& v){
	os<<"{";
	for(auto e:v)os<<e<<",";
	return os<<"}";
}

#define mp make_pair
#define mt make_tuple
#define one(x) memset(x,-1,sizeof(x))
#define zero(x) memset(x,0,sizeof(x))
#ifdef LOCAL
void dmpr(ostream&os){os<<endl;}
template<class T,class... Args>
void dmpr(ostream&os,const T&t,const Args&... args){
	os<<t<<" ";
	dmpr(os,args...);
}
#define dmp2(...) dmpr(cerr,__LINE__,##__VA_ARGS__)
#else
#define dmp2(...) void(0)
#endif

using uint=unsigned;
using ull=unsigned long long;

template<class t,size_t n>
ostream& operator<<(ostream&os,const array<t,n>&a){
	return os<<vc<t>(all(a));
}

template<int i,class T>
void print_tuple(ostream&,const T&){
}

template<int i,class T,class H,class ...Args>
void print_tuple(ostream&os,const T&t){
	if(i)os<<",";
	os<<get<i>(t);
	print_tuple<i+1,T,Args...>(os,t);
}

template<class ...Args>
ostream& operator<<(ostream&os,const tuple<Args...>&t){
	os<<"{";
	print_tuple<0,tuple<Args...>,Args...>(os,t);
	return os<<"}";
}

template<class t>
void print(t x,int suc=1){
	cout<<x;
	if(suc==1)
		cout<<"\n";
	if(suc==2)
		cout<<" ";
}

ll read(){
	ll i;
	cin>>i;
	return i;
}

vi readvi(int n,int off=0){
	vi v(n);
	rep(i,n)v[i]=read()+off;
	return v;
}

template<class T>
void print(const vector<T>&v,int suc=1){
	rep(i,v.size())
		print(v[i],i==int(v.size())-1?suc:2);
}

string readString(){
	string s;
	cin>>s;
	return s;
}

template<class T>
T sq(const T& t){
	return t*t;
}

//#define CAPITAL
void yes(bool ex=true){
	#ifdef CAPITAL
	cout<<"YES"<<"\n";
	#else
	cout<<"Yes"<<"\n";
	#endif
	if(ex)exit(0);
}
void no(bool ex=true){
	#ifdef CAPITAL
	cout<<"NO"<<"\n";
	#else
	cout<<"No"<<"\n";
	#endif
	if(ex)exit(0);
}
void possible(bool ex=true){
	#ifdef CAPITAL
	cout<<"POSSIBLE"<<"\n";
	#else
	cout<<"Possible"<<"\n";
	#endif
	if(ex)exit(0);
}
void impossible(bool ex=true){
	#ifdef CAPITAL
	cout<<"IMPOSSIBLE"<<"\n";
	#else
	cout<<"Impossible"<<"\n";
	#endif
	if(ex)exit(0);
}

constexpr ll ten(int n){
	return n==0?1:ten(n-1)*10;
}

const ll infLL=LLONG_MAX/3;

#ifdef int
const int inf=infLL;
#else
const int inf=INT_MAX/2-100;
#endif

int topbit(signed t){
	return t==0?-1:31-__builtin_clz(t);
}
int topbit(ll t){
	return t==0?-1:63-__builtin_clzll(t);
}
int botbit(signed a){
	return a==0?32:__builtin_ctz(a);
}
int botbit(ll a){
	return a==0?64:__builtin_ctzll(a);
}
int popcount(signed t){
	return __builtin_popcount(t);
}
int popcount(ll t){
	return __builtin_popcountll(t);
}
bool ispow2(int i){
	return i&&(i&-i)==i;
}
ll mask(int i){
	return (ll(1)<<i)-1;
}

bool inc(int a,int b,int c){
	return a<=b&&b<=c;
}

template<class t> void mkuni(vc<t>&v){
	sort(all(v));
	v.erase(unique(all(v)),v.ed);
}

ll rand_int(ll l, ll r) { //[l, r]
	#ifdef LOCAL
	static mt19937_64 gen;
	#else
	static mt19937_64 gen(chrono::steady_clock::now().time_since_epoch().count());
	#endif
	return uniform_int_distribution<ll>(l, r)(gen);
}

template<class t>
void myshuffle(vc<t>&a){
	rep(i,si(a))swap(a[i],a[rand_int(0,i)]);
}

template<class t>
int lwb(const vc<t>&v,const t&a){
	return lower_bound(all(v),a)-v.bg;
}

struct modinfo{uint mod,root;};
template<modinfo const&ref>
struct modular{
	static constexpr uint const &mod=ref.mod;
	static modular root(){return modular(ref.root);}
	uint v;
	//modular(initializer_list<uint>ls):v(*ls.bg){}
	modular(ll vv=0){s(vv%mod+mod);}
	modular& s(uint vv){
		v=vv<mod?vv:vv-mod;
		return *this;
	}
	modular operator-()const{return modular()-*this;}
	modular& operator+=(const modular&rhs){return s(v+rhs.v);}
	modular&operator-=(const modular&rhs){return s(v+mod-rhs.v);}
	modular&operator*=(const modular&rhs){
		v=ull(v)*rhs.v%mod;
		return *this;
	}
	modular&operator/=(const modular&rhs){return *this*=rhs.inv();}
	modular operator+(const modular&rhs)const{return modular(*this)+=rhs;}
	modular operator-(const modular&rhs)const{return modular(*this)-=rhs;}
	modular operator*(const modular&rhs)const{return modular(*this)*=rhs;}
	modular operator/(const modular&rhs)const{return modular(*this)/=rhs;}
	modular pow(int n)const{
		modular res(1),x(*this);
		while(n){
			if(n&1)res*=x;
			x*=x;
			n>>=1;
		}
		return res;
	}
	modular inv()const{return pow(mod-2);}
	/*modular inv()const{
		int x,y;
		int g=extgcd<ll>(v,mod,x,y);
		assert(g==1);
		if(x<0)x+=mod;
		return modular(x);
	}*/
	friend modular operator+(int x,const modular&y){
		return modular(x)+y;
	}
	friend modular operator-(int x,const modular&y){
		return modular(x)-y;
	}
	friend modular operator*(int x,const modular&y){
		return modular(x)*y;
	}
	friend modular operator/(int x,const modular&y){
		return modular(x)/y;
	}
	friend ostream& operator<<(ostream&os,const modular&m){
		return os<<m.v;
	}
	friend istream& operator>>(istream&is,modular&m){
		ll x;is>>x;
		m=modular(x);
		return is;
	}
	bool operator<(const modular&r)const{return v<r.v;}
	bool operator==(const modular&r)const{return v==r.v;}
	bool operator!=(const modular&r)const{return v!=r.v;}
	explicit operator bool()const{
		return v;
	}
};

extern constexpr modinfo base{998244353,3};
//extern constexpr modinfo base{1000000007,0};
//modinfo base{1,0};
using mint=modular<base>;

const int vmax=(1<<21)+10;
mint fact[vmax],finv[vmax],invs[vmax];
void initfact(){
	fact[0]=1;
	rng(i,1,vmax){
		fact[i]=fact[i-1]*i;
	}
	finv[vmax-1]=fact[vmax-1].inv();
	for(int i=vmax-2;i>=0;i--){
		finv[i]=finv[i+1]*(i+1);
	}
	for(int i=vmax-1;i>=1;i--){
		invs[i]=finv[i]*fact[i-1];
	}
}
mint choose(int n,int k){
	return fact[n]*finv[n-k]*finv[k];
}
mint binom(int a,int b){
	return fact[a+b]*finv[a]*finv[b];
}
mint catalan(int n){
	return binom(n,n)-(n-1>=0?binom(n-1,n+1):0);
}

const int nmax=ten(5)+10;
//beg,len,hasO,last
mint dp[2][2][nmax][2][2][2];

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout<<fixed<<setprecision(20);

	int n;cin>>n;
	rep(p,2)rep(q,2){
		dp[p][q][0][0][1-p][1-q]=1;
		rng(i,1,n+1){
			if(i>=1){
				rep(j,2){
					dp[p][q][i][1][0][0]+=dp[p][q][i-1][j][1][1];
				}
			}
			for(auto c:{2,4}){
				if(i>=c){
					rep(j,2)rep(k,2)rep(l,2)rng(a,k,2)rng(b,l,2){
						mint z=dp[p][q][i-c][j][k][l];
						if(k<a)z*=c;
						if(l<b)z*=c;
						dp[p][q][i][j][a][b]+=z;
					}
				}
			}
			if(i>=3){
				rep(k,2)rep(l,2)rep(j,2)rep(a,2)rep(b,2){
					dp[p][q][i][1][k][l]+=dp[p][q][i-3][j][a][b];
				}
			}
		}
	}

	mint ans=0;
	rep(p,2)ans+=dp[1][1][n-1][p][1][1];
	dmp(ans);
	rep(i,2)rep(j,2)rep(a,2)rep(b,2)rep(p,2)ans+=dp[i][j][n-3][p][a][b]*3;
	dmp(ans);
	for(auto c:{2,4}){
		if(n>=c){
			rep(i,2)rep(j,2)rep(a,2-i)rep(b,2-j){
				mint z=dp[i][j][n-c][1][a][b];
				if(i+a==0)z*=c;
				if(j+b==0)z*=c;
				ans+=z*c;
			}
		}
		dmp(ans);
	}
	cout<<ans<<endl;
}

#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
const int Mod=998244353,inv2=Mod+1>>1;
int qpow(int x,int y){
	int res=1;
	for (;y;y>>=1,x=1LL*x*x%Mod)
		if (y&1) res=1LL*res*x%Mod;
	return res;
}
inline int upd(int x){return x+(x>>31&Mod);}

int n;
namespace NTT
{
const int X=65536;
int Wn[X|1],W,imaxw[40];
int maxw,btw,id[X];
void prepare(int x){
	imaxw[0]=1; for(int i=1;i<=30;i++) imaxw[i]=1LL*imaxw[i-1]*inv2%Mod;
	for (W=1;W<=x;W<<=1);
	Wn[0]=1; for (int i=1,t=qpow(3,(Mod-1)/W);i<=W;i++) Wn[i]=1LL*Wn[i-1]*t%Mod;
}
void init(int x,bool tp=1){
	for (maxw=1,btw=0;maxw<=x;maxw<<=1,btw++);
	if (tp) for (int i=1,t=btw-1;i<maxw;i++) id[i]=(id[i>>1]>>1)|((i&1)<<t);
}
void ntt(int *w,int tp){
	for (int i=0;i<maxw;i++) if (i<id[i]) swap(w[i],w[id[i]]);
	for (int md=1,len=2;md<maxw;md=len,len<<=1)
		for (int l=0,stp=W/len*tp;l<maxw;l+=len)
			for (int u=l,cur=~tp?0:W,x,y;u-l<md;u++,cur+=stp){
				x=w[u],y=1LL*Wn[cur]*w[u+md]%Mod;
				w[u]=upd(x+y-Mod); w[u+md]=upd(x-y);
			}
}
}  //namespace NTT
using namespace NTT;
int h[50010];
int g[2][2][50010];
int f[2][2][50010];
inline void add(int &x,int y){x=upd(x+y-Mod);}
inline void add(int &x,ll y){x=(x+y)%Mod;}
void solve(int l,int r){
	if (l==r){
		if (l-2<3) return;
		add(f[0][0][l],f[0][1][l-2]);
		add(f[0][1][l],f[0][0][l-2]);
		add(f[1][0][l],f[1][1][l-2]);
		add(f[1][1][l],f[1][0][l-2]);
		return;
	}
	int mid=l+r>>1; solve(l,mid);
	init(r-l);
	static int F[2][2][X],G[2][2][X],H[2][2][X];
	for (int u=0;u<2;u++)
		for (int v=0;v<2;v++){
			for (int i=l;i<=mid;i++) F[u][v][i-l]=f[u][v][i];
			for (int i=mid-l+1;i<maxw;i++) F[u][v][i]=0;
			for (int i=0;i<=r-l;i++) G[u][v][i]=g[u][v][i];
			for (int i=r-l+1;i<maxw;i++) G[u][v][i]=0;
			ntt(F[u][v],1); ntt(G[u][v],1);
		}
	for (int u=0;u<2;u++)
		for (int v=0;v<2;v++){
			int *A=H[u][v];
			for (int i=0;i<maxw;i++) A[i]=0;
			for (int e=0;e<2;e++){
				int *B=F[u][e],*C=G[e][v];
				for (int i=0;i<maxw;i++) add(A[i],1LL*B[i]*C[i]);
			}
			ntt(A,-1);
			for (int i=mid+1;i<=r;i++){
				add(f[u][v][i],1LL*A[i-l]*imaxw[btw]);
			}
		}
	solve(mid+1,r);
}
int main()
{
	scanf("%d",&n);
	if (n==3) return puts("24"),0;
	if (n==4) return puts("4"),0;
	h[0]=h[2]=1;
	for (int i=4;i<=n;i+=2) h[i]=upd(h[i-2]+h[i-4]-Mod);
	for (int i=2;i<=n;i++){
		for (int u=0;u<2;u++)
			for (int v=0;v<2;v++){
				g[u][v][i+1]=1LL*h[i-(u^1)-(v^1)]*i%Mod*i%Mod;
			}
	}
	f[0][0][2]=2;
	for (int i=2;i<n;i++)
		for (int u=0;u<2;u++)
			for (int v=0;v<2;v++){
				f[u][v][i+1]=1LL*g[u][v][i+1]*(i+1)%Mod;
			}
	add(f[0][0][4],f[0][0][2]); add(f[1][1][4],f[0][0][2]);
	for (int j=3;2+j<=n;j++){
		add(f[0][1][2+j],1LL*f[0][0][2]*g[1][1][j]);
		add(f[0][0][2+j],1LL*f[0][0][2]*g[1][0][j]);
		add(f[1][0][2+j],1LL*f[0][0][2]*g[0][0][j]);
		add(f[1][1][2+j],1LL*f[0][0][2]*g[0][1][j]);
	}
	prepare(n-3);
	solve(3,n);
	int ans=upd(f[0][0][n]+f[1][1][n]-Mod);
	printf("%d\n",ans);
	return 0;
}

#include <cstdio>
#include <cstring>
typedef long long int64;
static const int LOGN = 18;
static const int MAXN = 1 << LOGN;
static const int MODULUS = 998244353;
static const int PRIMITIVE = 2192;
#define _  %  MODULUS
#define __ %= MODULUS
template <typename T> inline void swap(T &a, T &b) { static T t; t = a; a = b; b = t; }

int n;
int64 g[MAXN];
int64 g0[MAXN], g1[MAXN], g2[MAXN];
int64 f0[MAXN], f1[MAXN], f2[MAXN];

int64 q0[MAXN], q1[MAXN];
int64 t1[MAXN], t2[MAXN], t3[MAXN], t4[MAXN];

inline int qpow(int64 base, int exp)
{
    int64 ans = 1;
    for (; exp; exp >>= 1) { if (exp & 1) (ans *= base)__; (base *= base)__; }
    return ans;
}

int bitrev[LOGN][MAXN];
int root[2][LOGN];
inline void fft(int n, int64 *a, int direction)
{
    int s = __builtin_ctz(n);
    int64 u, v, r, w;
    for (int i = 0; i < n; ++i) if (i < bitrev[s][i]) swap(a[i], a[bitrev[s][i]]);
    for (int i = 1; i <= n; i <<= 1)
        for (int j = 0; j < n; j += i) {
            r = root[direction == -1][__builtin_ctz(i)];
            w = 1;
            for (int k = j; k < j + (i >> 1); ++k) {
                u = a[k];
                v = (a[k + (i >> 1)] * w)_;
                a[k] = (u + v)_;
                a[k + (i >> 1)] = (u - v + MODULUS)_;
                w = (w * r)_;
            }
        }
}

inline void convolve(int n, int64 *a, int64 *b, int64 *c)
{
    static int64 a1[MAXN], b1[MAXN];
    memcpy(a1, a, n * 2 * sizeof(int64));
    memcpy(b1, b, n * 2 * sizeof(int64));
    memset(a + n, 0, n * sizeof(int64));
    memset(b + n, 0, n * sizeof(int64));
    fft(n * 2, a, +1);
    fft(n * 2, b, +1);
    int64 q = qpow(n * 2, MODULUS - 2);
    for (int i = 0; i < n * 2; ++i) c[i] = a[i] * b[i]_;
    fft(n * 2, c, -1);
    for (int i = 0; i < n; ++i) c[i] = c[i] * q _;
    memcpy(a, a1, n * 2 * sizeof(int64));
    memcpy(b, b1, n * 2 * sizeof(int64));
}

// Calcukates f0 and f1.
void solve_1(int l, int r)
{
    if (l == r) {
        (f0[l] += g0[l])__;
        (f1[l] += g1[l])__;
        return;
    }

    int m = (l + r) >> 1;

    solve_1(l, m);

    int len = 1;
    while (len < r - l + 1) len <<= 1;
    for (int i = 0; i < len; ++i) q0[i] = (i + l <= m ? f0[i + l] : 0);
    for (int i = 0; i < len; ++i) q1[i] = (i + l <= m ? f1[i + l] : 0);
    for (int i = len; i < len * 2; ++i) q0[i] = q1[i] = 0;
    convolve(len, g0, q0, t1);
    convolve(len, g1, q0, t2);
    convolve(len, g1, q1, t3);
    convolve(len, g2, q1, t4);

    for (int i = 0; i < len; ++i) {
        if (i + l >= m + 1 - 1 && i + l <= r - 1) {
            (f0[i + l + 1] += t1[i])__;
            (f1[i + l + 1] += t2[i])__;
        }
        if (i + l >= m + 1 - 3 && i + l <= r - 3) {
            (f0[i + l + 3] += t3[i])__;
            (f1[i + l + 3] += t4[i])__;
        }
    }

    solve_1(m + 1, r);
}

// Calculates f2.
void solve_2(int l, int r)
{
    if (l == r) {
        (f2[l] += (g2[l] + (l >= 1 ? t1[l - 1] : 0)))__;
        return;
    }

    int m = (l + r) >> 1;

    solve_2(l, m);

    int len = 1;
    while (len < r - l + 1) len <<= 1;
    for (int i = 0; i < len; ++i) q0[i] = (i + l <= m ? f2[i + l] : 0);
    for (int i = len; i < len * 2; ++i) q0[i] = 0;
    convolve(len, g2, q0, t2);

    for (int i = 0; i < len; ++i) {
        if (i + l >= m + 1 - 3 && i + l <= r - 3) {
            (f2[i + l + 3] += t2[i])__;
        }
    }

    solve_2(m + 1, r);
}

int main()
{
    for (int s = 0; s < LOGN; ++s)
        for (int i = 0; i < (1 << s); ++i)
            bitrev[s][i] = (bitrev[s][i >> 1] >> 1) | ((i & 1) << (s - 1));
    for (int i = 0; i < LOGN; ++i) {
        root[0][i] = qpow(PRIMITIVE, MAXN >> i);
        root[1][i] = qpow(PRIMITIVE, MAXN - (MAXN >> i));
    }

    scanf("%d", &n);

    g[0] = 1;
    g[2] = 1;
    for (int i = 4; i <= n; i += 2) g[i] = (g[i - 4] + g[i - 2])_;
    for (int i = 0; i <= n; ++i) {
        g0[i] = g[i] * i _ * i _;
        g1[i] = g[i] * (i + 1)_ * (i + 1)_;
        g2[i] = g[i] * (i + 2)_ * (i + 2)_;
    }

    solve_1(0, n);

    int len = 1;
    while (len < n) len <<= 1;
    convolve(len, g1, f1, t1);
    solve_2(0, n);

    int64 ans = 0;

    ans += (g[n - 1] + g[n - 3]) * (n - 1)_ * (n - 1)_ * n _;
    for (int i = 2; i <= n - 2; ++i) {
        ans += g0[i - 1] * f0[n - i - 1]_ * i _;
        ans += g1[i - 2] * f1[n - i - 2]_ * 2 * i _;
        if (i >= 3 && i <= n - 3)
            ans += g2[i - 3] * f2[n - i - 3]_ * i _;
    }

    printf("%d\n", ans _);

    return 0;
}

#include <cstdio>
#include <algorithm>

typedef long long LL;
const int Mod = 998244353;
/*const int G = 3, iG = 332748118;
const int MS = 1 << 17;

inline int qPow(int b, int e) {
	int a = 1;
	for (; e; e >>= 1, b = (LL)b * b % Mod)
		if (e & 1) a = (LL)a * b % Mod;
	return a;
}

inline int gInv(int b) { return qPow(b, Mod - 2); }

int Inv[MS], Fac[MS], iFac[MS];

inline void Init(int N) {
	Fac[0] = 1;
	for (int i = 1; i < N; ++i) Fac[i] = (LL)Fac[i - 1] * i % Mod;
	iFac[N - 1] = gInv(Fac[N - 1]);
	for (int i = N - 1; i >= 1; --i) iFac[i - 1] = (LL)iFac[i] * i % Mod;
	for (int i = 1; i < N; ++i) Inv[i] = (LL)Fac[i - 1] * iFac[i] % Mod;
}

inline int Binom(int N, int M) {
	if (M < 0 || M > N) return 0;
	return (LL)Fac[N] * iFac[M] % Mod * iFac[N - M] % Mod;
}

int Sz, InvSz, R[MS];

inline int getB(int N) { int Bt = 0; while (1 << Bt < N) ++Bt; return Bt; }

inline void InitFNTT(int N) {
	int Bt = getB(N);
	if (Sz == (1 << Bt)) return ;
	Sz = 1 << Bt, InvSz = Mod - (Mod - 1) / Sz;
	for (int i = 1; i < Sz; ++i) R[i] = R[i >> 1] >> 1 | (i & 1) << (Bt - 1);
}

inline void FNTT(int *A, int Ty) {
	for (int i = 0; i < Sz; ++i) if (R[i] < i) std::swap(A[R[i]], A[i]);
	for (int j = 1, j2 = 2; j < Sz; j <<= 1, j2 <<= 1) {
		int wn = qPow(~Ty ? G : iG, (Mod - 1) / j2), w, X, Y;
		for (int i = 0, k; i < Sz; i += j2) {
			for (k = 0, w = 1; k < j; ++k, w = (LL)w * wn % Mod) {
				X = A[i + k], Y = (LL)w * A[i + j + k] % Mod;
				A[i + k] -= (A[i + k] = X + Y) >= Mod ? Mod : 0;
				A[i + j + k] += (A[i + j + k] = X - Y) < 0 ? Mod : 0;
			}
		}
	}
	if (!~Ty) for (int i = 0; i < Sz; ++i) A[i] = (LL)A[i] * InvSz % Mod;
}

inline void PolyConv(int *_A, int N, int *_B, int M, int *_C, int tN = -1) {
	if (tN == -1) tN = N + M - 1;
	static int A[MS], B[MS];
	InitFNTT(N + M - 1);
	for (int i = 0; i < N; ++i) A[i] = _A[i];
	for (int i = N; i < Sz; ++i) A[i] = 0;
	for (int i = 0; i < M; ++i) B[i] = _B[i];
	for (int i = M; i < Sz; ++i) B[i] = 0;
	FNTT(A, 1), FNTT(B, 1);
	for (int i = 0; i < Sz; ++i) A[i] = (LL)A[i] * B[i] % Mod;
	FNTT(A, -1);
	for (int i = 0; i < tN; ++i) _C[i] = A[i];
}*/

const int MN = 50005;

int N, Ans;
/*int g[MN];
int G0[MN], G1[MN], G2[MN];
int F0[MN], F1[MN], F2[MN];
int Tmp[MN];
void CDQ(int l, int r) {
	if (l == r) {
		F0[l] = (F0[l] + G0[l]) % Mod;
		F1[l] = (F1[l] + G1[l]) % Mod;
		F2[l] = (F2[l] + G2[l]) % Mod;
		return ;
	}
	int mid = (l + r) >> 1;
	CDQ(l, mid);
	PolyConv(F0 + l, mid - l + 1, G0, r - l + 1, Tmp + l, r - l + 1);
	for (int i = mid + 1; i <= r; ++i) F0[i] = (F0[i] + Tmp[i]) % Mod;
	PolyConv(F0 + l, mid - l + 1, G1, r - l + 1, Tmp + l, r - l + 1);
	for (int i = mid + 1; i <= r; ++i) F1[i] = (F1[i] + Tmp[i]) % Mod;
	PolyConv(F1 + l, mid - l + 1, G1, r - l + 1, Tmp + l, r - l + 1);
	for (int i = mid + 1; i <= r; ++i) F0[i] = (F0[i] + Tmp[i]) % Mod;
	for (int i = mid + 1; i <= r; ++i) F2[i] = (F2[i] + Tmp[i]) % Mod;
	PolyConv(F1 + l, mid - l + 1, G2, r - l + 1, Tmp + l, r - l + 1);
	for (int i = mid + 1; i <= r; ++i) F1[i] = (F1[i] + Tmp[i]) % Mod;
	PolyConv(F2 + l, mid - l + 1, G2, r - l + 1, Tmp + l, r - l + 1);
	for (int i = mid + 1; i <= r; ++i) F2[i] = (F2[i] + Tmp[i]) % Mod;
	CDQ(mid + 1, r);
}*/

int main() {
	scanf("%d", &N);
/*	g[2] = g[0] = 1;
	for (int i = 4; i <= N; ++i) g[i] = (g[i - 2] + g[i - 4]) % Mod;
	for (int i = 1; i <= N; ++i) G0[i] = (LL)(i - 1) * (i - 1) * g[i - 1] % Mod;
	for (int i = 2; i <= N; ++i) G1[i] = (LL)(i - 1) * (i - 1) * g[i - 2] % Mod;
	for (int i = 3; i <= N; ++i) G2[i] = (LL)(i - 1) * (i - 1) * g[i - 3] % Mod;
	CDQ(1, N);
	Ans = (LL)N * (G0[N] + G2[N]) % Mod;
	for (int i = 2; i <= N - 2; ++i)
		Ans = (Ans + ((LL)G0[i] * F0[N - i] + 2ll * G1[i] * F1[N - i] + (LL)G2[i] * F2[N - i]) % Mod * i) % Mod;*/
	static const int R[16] = {0, 4, 8, -1, 16, -10, 4, -12, -48, 26, -44, 15, -16, -4, -4, -1};
	int A[16] = {0, 0, 0, 24, 4, 240, 204, 1316, 2988, 6720, 26200, 50248, 174280, 436904, 1140888, 3436404};
	for (int i = 16; i <= N; ++i) {
		int x = 0;
		for (int j = 0; j < 16; ++j)
			x = (x + (LL)R[(i - j - 1) & 15] * A[j]) % Mod;
		A[i & 15] = x;
	}
	printf("%d\n", (A[N & 15] + Mod) % Mod);
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 998244353LL
#define pow DCXISSOHANDSOME

ll pow[20][131072],inv[131073];
ll f[50010][2][2],h[50010][2][2],g[50010][2][2],s[50010];
int n;

inline int rd()
{
	int x=0;char ch=getchar();
	for (;ch<'0'||ch>'9';ch=getchar());
	for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
	return x;
}

inline ll pls(const ll &x,const ll &y) { return (x+y<mod)?x+y:x+y-mod; }
inline ll mns(const ll &x,const ll &y) { return (x-y<0)?x-y+mod:x-y; }
inline ll ksm(ll x,ll y) { ll res=1;for (;y;y>>=1,x=x*x%mod) if (y&1) res=res*x%mod;return res; }

inline void pre_gao()
{
	inv[1]=1;
	for (int i=2;i<=131072;i++) inv[i]=(mod-mod/i)*inv[mod%i]%mod;
	for (int w=2,hh=1;w<=131072;w<<=1,hh++)
	{
		ll now=ksm(3,(mod-1)/w);
		pow[hh][0]=1;
		for (int j=1;j<(w>>1);j++) pow[hh][j]=pow[hh][j-1]*now%mod;
	}
}

inline void ntt(ll *a,int n,int on)
{
	static int rev[131072];
	for (int i=1;i<n;i++) rev[i]=(rev[i>>1]>>1)|((i&1)?(n>>1):0);
	for (int i=1;i<n;i++) if (i<rev[i]) swap(a[i],a[rev[i]]);
	for (int w=2,hh=1;w<=n;w<<=1,hh++) for (int k=0;k<n;k+=w) for (int j=k;j<k+(w>>1);j++)
	{
		ll u=a[j],t=a[j+(w>>1)]*pow[hh][j-k]%mod;
		a[j]=pls(u,t);a[j+(w>>1)]=mns(u,t);
	}
	if (on==-1)
	{
		reverse(a+1,a+n);
		for (int i=0;i<n;i++) a[i]=a[i]*inv[n]%mod;
	}
}

inline void solve(int l,int r)
{
	static ll c[131072],d[131072];
	if (l==r)
	{
		for (int i=0;i<2;i++) for (int j=0;j<2;j++) f[l][i][j]=pls(h[l-1][i][j],g[l-1][i][j]);
		return;
	}
	int mid=(l+r)>>1;
	solve(l,mid);
	int len=1;
	for (;len<=r-l+mid-l;len<<=1);
	for (int h1=0;h1<2;h1++) for (int h2=0;h2<2;h2++) for (int m=0;m<2;m++)
	{
		for (int i=l;i<=mid;i++) c[i-l]=f[i][h1][m];
		for (int i=0;i<=r-l;i++) d[i]=g[i][m][h2];
		memset(c+mid-l+1,0,sizeof(ll)*(len-(mid-l+1)));
		memset(d+r-l+1,0,sizeof(ll)*(len-(r-l+1)));
		ntt(c,len,1);ntt(d,len,1);
		for (int i=0;i<len;i++) c[i]=c[i]*d[i]%mod;
		ntt(c,len,-1);
		for (int i=mid+1;i<=r;i++) h[i][h1][h2]=pls(h[i][h1][h2],c[i-l]);
	}
	solve(mid+1,r);
}

int main()
{
	n=rd();pre_gao();
	s[0]=s[2]=1;
	for (int i=4;i<=n;i+=2) s[i]=pls(s[i-2],s[i-4]);
	for (int i=1;i<=n;i++) for (int j=0;j<2;j++) for (int k=0;k<2;k++) if (j+k<=i) g[i][j][k]=pls(g[i][j][k],s[i-j-k]*i%mod*i%mod);
	solve(1,n);
	ll ans=0;
	ans=pls(ans,pls(g[n-1][0][0],g[n-1][1][1])*n%mod);
	for (int i=0;i<n-1;i++) for (int j=0;j<2;j++) for (int k=0;k<2;k++) ans=pls(ans,f[i+1][j][k]*g[n-i-2][k][j]%mod*(n-i-1)%mod);
	printf("%lld\n",ans);
	return 0;
}

//Zory-2020
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
// typedef __int128 ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define FR first
#define SE second
#define MP make_pair
#define PB push_back
#define vc vector
#define db double
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define bin(x) (1ll<<(x))
#define fo(i,l,r) for(int i=(l),I=(r);i<=I;i++)
#define fd(i,r,l) for(int i=(r),I=(l);i>=I;i--)
#define mem(x,val) memset(x,val,sizeof x)
#define Swap(a,b,n) for(int I=0;I<=n;I++) swap(a[I],b[I])
#define PC __builtin_popcountll
#ifdef DEBUG
	#define debug(A,args...) fprintf(stderr,A,##args)
#else
	#define debug(A,args...)
#endif
#define deb debug("line %d\n",__LINE__)
namespace mine
{
	ll qread()
	{
		ll 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(ll num){if(num<0) putchar('-'),num=-num;if(num>=10) write(num/10);putchar('0'+num%10);}
	void write1(ll num){write(num);putchar(' ');}
	void write2(ll 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;}
	ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
	bool IN(ll x,ll l,ll r){return l<=x and x<=r;}
	void GG(){puts("No");exit(0);}

	const db 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);}
	ll qpower(ll x,ll e,int mod=MOD){ll ans=1;while(e){if(e&1)ans=ans*x%mod;x=x*x%mod;e>>=1;}return ans;}
	ll invm(ll x){return qpower(x,MOD-2);}
	//const int MM=1e6+10;
	//ll fac[MM],facinv[MM],Inv[MM];ll C(int n,int m){return n<0 or m<0 or n<m?0:fac[n]*facinv[m]%MOD*facinv[n-m]%MOD;}
	//void PRE()
	//{
	//	fac[0]=1;fo(i,1,MM-1) fac[i]=fac[i-1]*i%MOD;
	//	facinv[MM-1]=invm(fac[MM-1]);fd(i,MM-1,1) facinv[i-1]=facinv[i]*i%MOD;
	//	Inv[1]=1;fo(i,2,MM-1) Inv[i]=(MOD-MOD/i)*Inv[MOD%i]%MOD;
	//}

	const int N=2e6+10;
	//------------------FIXED------------------
	int F[N];int getF(int x){ return x>=0 and x%2==0?F[x/2]:0;}
	int dp[N][4][2][3];//dp(i,放球状态,前两个被匹配，其中第二维=2表示nb点)
	void main()
	{
		F[0]=F[1]=1;fo(i,2,N-1) F[i]=mm(F[i-1]+F[i-2]);
		int n=qread(),ans=0;
		dp[0][0][1][2]=1;
		fo(i,1,n-1) fo(s2,0,3) fo(s3,0,3) if((s2&s3)==0) fo(a,0,1) fo(b,0,2)
		{
			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);}
			}
		}
		fo(i,0,n-1)
		{
			ll 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 );
		}
		mem(dp,0);fo(s,0,3) dp[1][s][1][1]=1;//1连n-1
		fo(i,2,n-1) fo(s2,0,3) fo(s3,0,3) if((s2&s3)==0) fo(a,0,1) fo(b,0,2)
		{
			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);}
			}
		}
		fo(i,0,n-1)
		{
			ll 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);
	}
};//变量重名！
signed main()
{
	#ifdef DEBUG
	freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	#endif
	mine::main();
	debug("\n---------------------Zory---------------------\nTime: %.2lf s",1.0*clock()/CLOCKS_PER_SEC);
}

#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<ctime>
#include<map>
#include<bitset>
#include<set>
#include<assert.h>
//#include<chrono>
//#include<random>
#include<iostream>
#define LL long long
#define mp(x,y) make_pair(x,y)
#define pll pair<long long,long long>
#define pii pair<int,int>
#define SZ(x) ((int)x.size())
#define VI vector<int>
using namespace std;
//mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
inline LL read()
{
	LL f=1,x=0;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int stack[20];
template<typename T>inline void write(T x)
{
	if(x<0){putchar('-');x=-x;}
    if(!x){putchar('0');return;}
    int top=0;
    while(x)stack[++top]=x%10,x/=10;
    while(top)putchar(stack[top--]+'0');
}
template<typename T>inline void pr1(T x){write(x);putchar(' ');}
template<typename T>inline void pr2(T x){write(x);putchar('\n');}
template<typename T>inline void chkmin(T &x,T y){x=x<y?x:y;}
template<typename T>inline void chkmax(T &x,T y){x=x>y?x:y;}
const int mod=998244353;
const int MAXN=200005;
inline void ad(int &x,int y){x+=y;if(x>=mod)x-=mod;}
inline void dl(int &x,int y){x-=y;if(x<0)x+=mod;}
inline int add(int x,int y){return x+y>=mod?x+y-mod:x+y;}
inline int dec(int x,int y){return x-y<0?x-y+mod:x-y;}
namespace Poly
{
	int pow_mod(int a,int b)
	{
		int ret=1;
		for(;b;b>>=1,a=1LL*a*a%mod)if(b&1)ret=1LL*ret*a%mod;
		return ret;
	}
	vector<int> wn[25];
	void init_wn()
	{
		for(int i=1,t=0;i<MAXN*4;i<<=1,++t)
		{
			int w1=pow_mod(3,(mod-1)/(i<<1));wn[t].resize(i);
			for(int j=0,u=1;j<i;j++,u=1LL*u*w1%mod)
				wn[t][j]=u;
		}
	}
	int R[MAXN*4],L;
	int NTTinit(int n,int m)
	{
		int ret=1;L=0;
		for(ret=1;ret<n+m-1;ret<<=1)++L;
		for(int i=0;i<ret;i++)R[i]=(R[i>>1]>>1)|(i&1)<<(L-1);return ret;
	}
	void NTT(int *y,int len,int on)
	{
		for(int i=0;i<len;i++)if(i<R[i])swap(y[i],y[R[i]]);
		for(int i=1,t=0;i<len;i<<=1,t++)for(int j=0;j<len;j+=(i<<1))for(int k=0;k<i;k++)
		{
			int u=y[j+k],v=1LL*y[j+k+i]*wn[t][k]%mod;
			y[j+k]=add(u,v);y[j+k+i]=dec(u,v);
		}if(on==-1)
		{
			reverse(y+1,y+len);
			for(int i=0,temp=pow_mod(len,mod-2);i<len;i++)y[i]=1LL*y[i]*temp%mod;
		}
	}
	int A[MAXN*4],B[MAXN*4];
	void clr(int *y,int len){for(int i=0;i<len;i++)A[i]=0;}
	VI mul(VI a,VI b)
	{
		int n=SZ(a),m=SZ(b);
		int ln=NTTinit(n,m);
		for(int i=0;i<n;i++)A[i]=a[i];for(int i=0;i<m;i++)B[i]=b[i];
		NTT(A,ln,1);NTT(B,ln,1);
		for(int i=0;i<ln;i++)A[i]=1LL*A[i]*B[i]%mod;
		NTT(A,ln,-1);VI ret;ret.resize(n+m-1);
		for(int i=0;i<n+m-1;i++)ret[i]=A[i];clr(A,ln);clr(B,ln);
		return ret;
	}
}
using Poly::mul;
int f[MAXN][2][2];
int coef[2][2][MAXN],n;
void getcoef()
{
	coef[0][0][0]=1;
	for(int i=1;i<MAXN;i++)
	{
		if(i-2>=0)ad(coef[0][0][i],coef[0][0][i-2]);
		if(i-4>=0)ad(coef[0][0][i],coef[0][0][i-4]);
		//coef(0,0)
		if(i-1>=0)ad(coef[0][1][i],coef[0][0][i-1]);
		//coef(0,1)
		if(i-2>=0)ad(coef[1][0][i],coef[1][0][i-2]);
		if(i-4>=0)ad(coef[1][0][i],coef[1][0][i-4]);
		if(i==1)ad(coef[1][0][i],1);
		//coef(1,0)
		if(i-1>=0)ad(coef[1][1][i],coef[1][0][i-1]);
		//coef(1,1)
	}
	for(int i=1;i<MAXN;i++)for(int u=0;u<=1;u++)for(int v=0;v<=1;v++)
		coef[u][v][i]=1LL*coef[u][v][i]*i%mod*i%mod;
}
int g[MAXN][2][2];
VI A,B;
void trans(int a,int b,int c,int l,int mid,int r)
{
	A.clear();B.clear();
	for(int i=l;i<=mid;i++)A.push_back(f[i][a][b]);
	B.push_back(0);
	for(int i=1;i+l-1<=r;i++)B.push_back(coef[b][c][i]);
//	puts("YES");
//	for(auto p:A)pr1(p);puts("");
//	for(auto p:B)pr1(p);puts("");
	A=mul(A,B);
//	for(auto p:A)pr1(p);puts("");
	for(int i=mid+1;i<=r;i++)ad(g[i][a][c],A[i-l-1]);
}
void cdq(int l,int r)
{
	if(l==r)
	{
		for(int i=0;i<=1;i++)for(int j=0;j<=1;j++)
			f[l][i][j]=add(g[l][i][j],coef[i][j][l]);
		return ;
	}int mid=(l+r)/2;cdq(l,mid);
	for(int u=0;u<=1;u++)for(int a=0;a<=1;a++)for(int v=0;v<=1;v++)
		trans(u,a,v,l,mid,r);
	cdq(mid+1,r);
}
void getf(){cdq(1,n);}
int main()
{
	#ifdef Rose
		double BeginJudgeTime=clock();
	#endif
	Poly::init_wn();
	getcoef();
	n=read();
	if(n<=2)return pr2(0),0;
	getf();
	int ans=0;
	for(int i=1;i<n-2;i++)
	{
		int S=0;
		for(int u=0;u<=1;u++)
			for(int a=0;a<=1;a++)
				ad(S,1LL*f[n-2-i][u][a]*coef[a][u][i]%mod);
		ad(ans,1LL*S*(i+1)%mod);
	}
	ad(ans,1LL*coef[0][0][n-1]*n%mod);
	ad(ans,1LL*coef[1][1][n-1]*n%mod);
	pr2(ans);
	#ifdef Rose
		double EndJudgeTime=clock();
		cerr<<"JudgeTime is"<<" ";
		cerr<<(EndJudgeTime-BeginJudgeTime)/CLOCKS_PER_SEC<<endl;
	#endif
	return 0;
}

#include<bits/stdc++.h>
#define _ %mod
#define N 50010
using namespace std;
const int mod=998244353;
int n,L,R[1<<18],p[1<<18],q[1<<18];
int add(int a){return a<mod?a:a-mod;}
int dec(int a){return a<0?a+mod:a;}
int mi(int a,int b)
{
    int res=1;
    while(b)
    {
        if(b&1)res=1ll*res*a _;
        a=1ll*a*a _;
        b>>=1;
    }
    return res;
}
void fft(int x[],int n,int f)
{
    for(int i=0;i<n;++i)
        if(i<R[i])
            swap(x[i],x[R[i]]);
    for(int i=1;i<n;i<<=1)
    {
        int wn=mi(3,(mod-1)/(i<<1));
        if(!~f)wn=mi(wn,mod-2);
        for(int j=0;j<n;j+=i<<1)
            for(int k=0,w=1;k<i;++k,w=1ll*w*wn _)
            {
                int l=x[j+k],r=1ll*w*x[i+j+k] _;
                x[j+k]=add(l+r);x[i+j+k]=dec(l-r);
            }
    }
    if(!~f)
    {
        int inv=mi(n,mod-2);
        for(int i=0;i<n;++i)
            x[i]=1ll*x[i]*inv _;
    }
}
int g[N],sqr[N];
struct node
{
    int n;
    vector<int> x;
    node(){n=0;}
    node operator * (const node &e)const
    {
        node res;
        int m=e.n;
        res.n=n+m;
        int nn;L=0;
        for(nn=1;nn<=n+m;nn<<=1)++L;--L;
        for(int i=0;i<nn;++i)R[i]=(R[i>>1]>>1)|((i&1)<<L);
        for(int i=0;i<nn;++i)p[i]=q[i]=0;
        for(int i=0;i<=n;++i)p[i]=x[i];
        for(int i=0;i<=m;++i)q[i]=e.x[i];
        fft(p,nn,1);fft(q,nn,1);
        for(int i=0;i<nn;++i)
            p[i]=1ll*p[i]*q[i] _;
        fft(p,nn,-1);
        for(int i=0;i<=n+m;++i)
            res.x.push_back(p[i]);
        return res;
    }
    node operator % (const int &a)const
    {
        node res=*this;
        while(res.n>=a)
            --res.n,res.x.pop_back();
        return res;
    }
}f0,f1,f2;
void add(node &a,node b,int be)
{
	for(int i=0;i<=a.n;++i)if(i+be>=0)
		a.x[i]=(a.x[i]+b.x[i+be]) _;
}
void solve(int n)
{
	if(n==0)return;
	int m=n>>1;
	node e0,e1,e2;e0.n=e1.n=e2.n=n-m-1;
	for(int i=m+1;i<=n;++i)
		e0.x.push_back(f0.x[i]),
		e1.x.push_back(f1.x[i]),
		e2.x.push_back(f2.x[i]);
	f0=f0%(m+1);f1=f1%(m+1);f2=f2%(m+1);
	solve(m);
	node g0,g1,g2;g0.n=g1.n=g2.n=n;
	for(int i=0;i<=n;++i)
		g0.x.push_back(1ll*g[i]*sqr[i] _),
		g1.x.push_back(1ll*g[i]*sqr[i+1] _),
		g2.x.push_back(1ll*g[i]*sqr[i+2] _);
	add(e0,f0*g0,m);add(e0,f1*g1,m-2);
	add(e1,f0*g1,m);add(e1,f1*g2,m-2);
	add(e2,f1*g1,m);add(e2,f2*g2,m-2);
	node a=f0,b=f1,c=f2;
	f0=e0;f1=e1;f2=e2;
	solve(n-m-1);
	for(int i=m+1;i<=n;++i)
		a.x.push_back(f0.x[i-m-1]),
		b.x.push_back(f1.x[i-m-1]),
		c.x.push_back(f2.x[i-m-1]);
	a.n=b.n=c.n=n;
	f0=a;f1=b;f2=c;
}
int main()
{
	scanf("%d",&n);
	g[0]=g[2]=1;
	for(int i=4;i<=n+3;++i)g[i]=(g[i-2]+g[i-4]) _;
	for(int i=1;i<=n+3;++i)sqr[i]=1ll*i*i _;
	f0.n=f1.n=f2.n=n;
	for(int i=0;i<=n;++i)
		f0.x.push_back(1ll*g[i]*sqr[i] _),
		f1.x.push_back(1ll*g[i]*sqr[i+1] _),
		f2.x.push_back(1ll*g[i]*sqr[i+2] _);
	solve(n);
	int ans=1ll*sqr[n-1]*(g[n-1]+g[n-3]) _*n _;
	for(int i=3;i<n;++i)
	{
		ans=(ans+1ll*sqr[i-2]*g[i-2] _*f0.x[n-i] _*(i-1)) _;
		ans=(ans+1ll*sqr[i-2]*g[i-3] _*f1.x[n-i-1] _*2*(i-1)) _;
		if(i>=4 && i+1<n)ans=(ans+1ll*sqr[i-2]*g[i-4] _*f2.x[n-i-2] _*(i-1)) _;
	}
	printf("%d\n",ans _);
}

#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 2e5 + 5;
const int mod = 998244353;
const int G = 3;
inline int Pow(ll a, int x) {
	ll res = 1;
	while (x) {
		if (x & 1) res = res * a % mod;
		a = a * a % mod;
		x >>= 1;
	}
	return res;
}
void NTT(int *a, int n, int rev) {
	for (int i = 0, j = 0; i < n; ++i) {
		if (i > j) swap(a[i], a[j]);
		for (int k = n >> 1; (j ^= k) < k; k >>= 1);
	}
	for (int i = 2; i <= n; i <<= 1) {
		int m = i >> 1;
		int w = Pow(G, (mod - 1) / i);
		if (rev == -1) w = Pow(w, mod - 2);
		for (int j = 0; j < n; j += i) {
			ll Wx = 1;
			for (int k = 0; k != m; k++) {
				ll z = a[j + m + k] * Wx % mod;
				a[j + m + k] = a[j + k] - z + mod;
				if (a[j + m + k] >= mod) a[j + m + k] -= mod;
				a[j + k] = a[j + k] + z;
				if (a[j + k] >= mod) a[j + k] -= mod;
				Wx = Wx * w % mod;
			}
		}
	}
	if (rev == -1) {
		ll inv = Pow(n, mod - 2);
		for (int i = 0; i < n; i++) a[i] = a[i] * inv % mod;
	}
}
int n, len, g[N], f0[N], f1[N], f2[N];
int F1[N], F2[N], F0[N], G1[N], G2[N], G3[N], a[N];
ll ans, sqr[N];
void solve(int l, int r) {
	if (l == r) return;
	int mid = l + r >> 1;
	solve(l, mid);
	len = 1;
	while (len < r - l + 1) len <<= 1;
	for (int i = 0; i < len; i++) {
		F0[i] = F1[i] = F2[i] = 0;
		G1[i] = G2[i] = G3[i] = 0;
	}
	for (int i = l; i <= mid; i++) {
		F0[i - l] = f0[i];
		F1[i - l] = f1[i];
		F2[i - l] = f2[i];
	}
	for (int i = 2; i <= r - l; i++) {
		G1[i] = (ll)g[i - 1] * sqr[i - 1] % mod;
		G2[i] = (ll)g[i - 2] * sqr[i - 1] % mod;
		if (i > 2) G3[i] = (ll)g[i - 3] * sqr[i - 1] % mod;
	}
	NTT(F0, len, 1); NTT(F1, len, 1); NTT(F2, len, 1);
	NTT(G1, len, 1); NTT(G2, len, 1); NTT(G3, len, 1);
	//0
	for (int i = 0; i < len; i++) a[i] = (ll)F0[i] * G1[i] % mod;
	NTT(a, len, -1);
	for (int i = mid + 1; i <= r; i++) (f0[i] += a[i - l]) %= mod;
	for (int i = 0; i < len; i++) a[i] = (ll)F1[i] * G2[i] % mod;
	NTT(a, len, -1);
	for (int i = mid + 1; i <= r; i++) (f0[i] += a[i - l]) %= mod;
	//1
	for (int i = 0; i < len; i++) a[i] = (ll)F1[i] * G1[i] % mod;
	NTT(a, len, -1);
	for (int i = mid + 1; i <= r; i++) (f1[i] += a[i - l]) %= mod;
	for (int i = 0; i < len; i++) a[i] = (ll)F2[i] * G2[i] % mod;
	NTT(a, len, -1);
	for (int i = mid + 1; i <= r; i++) (f1[i] += a[i - l]) %= mod;
	//2
	for (int i = 0; i < len; i++) a[i] = (ll)F1[i] * G2[i] % mod;
	NTT(a, len, -1);
	for (int i = mid + 1; i <= r; i++) (f2[i] += a[i - l]) %= mod;
	for (int i = 0; i < len; i++) a[i] = (ll)F2[i] * G3[i] % mod;
	NTT(a, len, -1);
	for (int i = mid + 1; i <= r; i++) (f2[i] += a[i - l]) %= mod;
	solve(mid + 1, r);
}
int main() {
	for (int i = 1; i < N; i++) sqr[i] = (ll)i * i % mod;
	cin >> n;
	g[0] = 1;
	for (int i = 1; i <= n; i++) {
		if (i - 2 >= 0) (g[i] += g[i - 2]) %= mod;
		if (i - 4 >= 0) (g[i] += g[i - 4]) %= mod;
	}
	f0[0] = f2[0] = 1;
	solve(0, n);
	// n^2
	/*	for (int i = 1; i <= n; i++) {
		for (int j = 2; j <= i; j++) {
		(f0[i] += (ll)f0[i - j] * g[j - 1] % mod * sqr[j - 1] % mod) %= mod;
		if (j >= 2) (f0[i] += (ll)f1[i - j] * g[j - 2] % mod * sqr[j - 1] % mod) %= mod;
		(f1[i] += (ll)f1[i - j] * g[j - 1] % mod * sqr[j - 1] % mod) %= mod;
		if (j >= 2) (f1[i] += (ll)f2[i - j] * g[j - 2] % mod * sqr[j - 1] % mod) %= mod;
		if (j >= 2) (f2[i] += (ll)f1[i - j] * g[j - 2] % mod * sqr[j - 1] % mod) %= mod;
		if (j >= 3) (f2[i] += (ll)f2[i - j] * g[j - 3] % mod * sqr[j - 1] % mod) %= mod;
	}
	}
	*/
	ans = (ll)(g[n - 1] + g[n - 3]) * n % mod * sqr[n - 1] % mod;
	for (int i = 1; i < n - 2	; i++) {
	ll tmp = 0;
	(tmp += (ll)g[i] * f0[n - i - 1] % mod * sqr[i] % mod) %= mod;
	(tmp += (ll)g[i - 1] * f1[n - i - 1] % mod * sqr[i] % mod) %= mod;
		if (i >= 2) (tmp += (ll)g[i - 2] * f2[n - i - 1] % mod * sqr[i] % mod) %= mod;
		(tmp += (ll)g[i - 1] * f1[n - i - 1] % mod * sqr[i] % mod) %= mod;
		tmp = tmp * (i + 1) % mod;
		(ans += tmp) %= mod;
	}
	cout << ans;
}

#include "iostream"
#include "algorithm"
#include "cstring"
#include "cstdio"
#include "cmath"
#include "vector"
#include "map"
#include "set"
#include "queue"
using namespace std;
#define MAXN 1000006
//#define int long long
#define rep(i, a, b) for (int i = (a), i##end = (b); i <= i##end; ++i)
#define per(i, a, b) for (int i = (a), i##end = (b); i >= i##end; --i)
#define pii pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define all(x) (x).begin() , (x).end()
#define mem( a ) memset( a , 0 , sizeof a )
typedef long long ll;
#define P 998244353
int n;

int Pow( int x , int a ) {
    int ans = 1 , cur = x % P;
    while( a ) {
        if( a & 1 ) ans = 1ll * ans * cur % P;
        cur = 1ll * cur * cur % P , a >>= 1;
    }
    return ans;
}

int g[MAXN];
inline int calc( int len , int x ) {
	if( len < 0 || ( len & 1 ) ) return 0;
	return x * 1ll * x % P * g[len] % P;
}

int f0[MAXN] , f1[MAXN] , f2[MAXN];
void init( int n ) {
	g[0] = g[2] = 1;
	for( int i = 4 ; i <= n ; i += 2 ) g[i] = ( g[i - 2] + g[i - 4] ) % P;
	rep( i , 2 , n ) {
		f0[i] = calc( i - 1 , i - 1 ) , f1[i] = calc( i - 2 , i - 1 ) , f2[i] = calc( i - 3 , i - 1 );
		rep( j , 2 , i - 1 ) {
			f0[i] = ( f0[i] + f0[i - j] * 1ll * calc( j - 1 , j - 1 ) + f1[i - j] * 1ll * calc( j - 2 , j - 1 ) ) % P;
			f1[i] = ( f1[i] + f0[i - j] * 1ll * calc( j - 2 , j - 1 ) + f1[i - j] * 1ll * calc( j - 3 , j - 1 ) ) % P;
			f2[i] = ( f2[i] + f1[i - j] * 1ll * calc( j - 2 , j - 1 ) + f2[i - j] * 1ll * calc( j - 3 , j - 1 ) ) % P;
		}
	}
}
inline int getit( int n ) {
	int ret = n * 1ll * ( calc( n - 1 , n - 1 ) + calc( n - 3 , n - 1 ) ) % P;
	rep( i , 2 , n ) {
		ret = ( ret + calc( i - 1 , i - 1 ) * 1ll * f0[n - i] % P * i ) % P;
		ret = ( ret + calc( i - 2 , i - 1 ) * 1ll * f1[n - i] % P * i * 2 ) % P;
		ret = ( ret + calc( i - 3 , i - 1 ) * 1ll * f2[n - i] % P * i ) % P;
	}
	return ret;
}

int del[MAXN];
vi BM( vi a ) { // BellMan ford!
	vi re , las;
	int fail = -1 , n = a.size();
	for( int i = 0 ; i < n ; ++ i ) {
		del[i] = a[i];
		for( int j = 0 ; j < re.size() ; ++ j ) del[i] = ( del[i] + P - a[i - j - 1] * 1ll * re[j] % P ) % P;
		if( !del[i] ) continue;
		if( fail == -1 ) { fail = i , re.resize( i + 1 ); continue; }
		int mu = del[i] * 1ll * Pow( del[fail] , P - 2 ) % P;
		vi tmp = re; re.clear() , re.resize( i - fail - 1 ) , re.pb( mu );
		for( int x : las ) re.pb( x * 1ll * ( P - mu ) % P );
		fail = i , las = tmp;
		if( re.size() < las.size() ) re.resize( tmp.size() );
		for( int i = 0 ; i < tmp.size() ; ++ i ) re[i] = ( re[i] + tmp[i] ) % P;
	}
	return re;
}

int dp[MAXN];

void solve() {
	init( 666 );
	vi tr;
	for( int i = 3 ; i <= 666 ; ++ i ) dp[i] = getit( i ) , tr.pb( dp[i] );
	vi as = BM( tr );
	cin >> n;
	for( int j = 667 ; j <= n ; ++ j ) for( int i = 0 ; i < as.size() ; ++ i ) dp[j] = ( dp[j] + as[i] * 1ll * dp[j - i - 1] ) % P;
	cout << dp[n] << endl;
}

signed main() {
//    int T;cin >> T;while( T-- ) solve();
    solve();
}

#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <list>
#include <cassert>
#include <ctime>
#include <climits>
#include <functional>
using namespace std;

#define PB push_back
#define MP make_pair
#define SZ(v) ((int)(v).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n) FORE(i,0,n)
#define FORSZ(i,a,v) FOR(i,a,SZ(v))
#define REPSZ(i,v) REP(i,SZ(v))
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXN = 50000;
const int MOD = 998244353;
const int PRIMROOT = 3;
const int MAXSZ = 1 << 15;

int n;
int f[4][MAXN + 1]; // f[p][x]=g[p][x]+sum(q,sum(i<x, f[q][i]*c[p][q][x-i]))
int g[4][MAXN + 1];
int c[4][4][MAXN + 1];

int A[2 * MAXSZ];
int B[2 * MAXSZ];
int At[2 * MAXSZ];
int Bt[2 * MAXSZ];
int rootpow[2 * MAXSZ];

int pw(int x, int n) { int ret = 1; while (true) { if (n & 1) ret = (ll)ret*x%MOD; if ((n >>= 1) == 0) return ret; x = (ll)x*x%MOD; } }
void fft(int *to, int *from, int step, int n) {
	if (n == 1) { to[0] = from[0]; return; }
	int h = n / 2;
	fft(to, from, step + 1, h);
	fft(to + h, from + (1 << step), step + 1, h);
	REP(i, h) {
		int e = to[i], o = (ll)to[i + h] * rootpow[i << step] % MOD;
		to[i] = (e + o) % MOD;
		to[i + h] = (e + MOD - o) % MOD;
	}
}
void addprod(int *a, int na, int *b, int nb, int *c, int nc) {
	int SZ = 1; while ((SZ < na || SZ < nb) && SZ < nc) SZ *= 2;
	if (SZ <= 16) { REP(i, na) REP(j, nb) if (i + j < nc) c[i + j] = (c[i + j] + (ll)a[i] * b[j]) % MOD; return; }
	REP(i, 2 * SZ) A[i] = i < na &&i < SZ ? a[i] : 0, B[i] = i < nb&&i < SZ ? b[i] : 0;
	int root = pw(PRIMROOT, (MOD - 1) / (2 * SZ));
	rootpow[0] = 1; FOR(i, 1, 2 * SZ) rootpow[i] = (ll)rootpow[i - 1] * root%MOD;
	fft(At, A, 0, 2 * SZ);
	fft(Bt, B, 0, 2 * SZ);
	REP(i, 2 * SZ) At[i] = (ll)At[i] * Bt[i] % MOD;
	reverse(rootpow + 1, rootpow + 2 * SZ);
	fft(A, At, 0, 2 * SZ);
	reverse(rootpow + 1, rootpow + 2 * SZ);
	int mlt = pw(2 * SZ, MOD - 2);
	REP(i, 2 * SZ) if (i < nc) c[i] = (c[i] + (ll)A[i] * mlt) % MOD;
}

void calc() {
	//REP(p, 4) REP(q, 4) { bool allzero = true; REPE(x, n) if (c[p][q][x] != 0) allzero = false; if (allzero) printf("%d %d\n", p, q); }
	REPE(x, n) REP(p, 4) f[p][x] = g[p][x];
	REPE(x, n) REP(p, 4) {
		//REP(q, 4) REP(i, x) f[p][x] = (f[p][x] + (ll)c[p][q][x - i] * f[q][i]) % MOD;
		REP(q, 4) if ((p + q) % 2 == 0) for (int len = 1; (x + 1) % len == 0; len *= 2) {
			//printf("addprod(c[%d][%d]+%d,%d,f[%d]+%d,%d,f[%d]+%d,%d)\n", p, q, len, min(len, n - len + 1), q, x + 1 - len, len, p, x + 1, n - x);
			addprod(c[p][q] + len, min(len, n - len + 1), f[q] + x + 1 - len, len, f[p] + x + 1, n - x);
		}
		//printf("f[%d][%d][%d]=%d\n", x, p / 2, p % 2, f[p][x]);
	}
}

int h[MAXN + 1];

void run() {
	scanf("%d", &n);
	clock_t START = clock();

	h[0] = 1; FORE(i, 1, n) { h[i] = 0; if (i >= 2) h[i] = (h[i] + h[i - 2]) % MOD; if (i >= 4) h[i] = (h[i] + h[i - 4]) % MOD; }
	REP(y, 2) REP(z, 2) {
		REPE(x, n) g[2 * y + z][x] = (ll)(y + x + z)*(y + x + z) % MOD*h[x] % MOD;
		FORE(i, 1, n) c[2 * y + z][2 * 0 + z][i] = (ll)(y + i - 1)*(y + i - 1) % MOD*h[i - 1] % MOD;
		FORE(i, 3, n) c[2 * y + z][2 * 1 + z][i] = (ll)(y + i - 2)*(y + i - 2) % MOD*h[i - 3] % MOD;
	}
	calc();
	int ret = (f[2 * 0 + 0][n - 1] + f[2 * 1 + 1][n - 3] + (ll)(n - 1)*(n - 1) % MOD*(n - 1) % MOD*h[n - 1] + (ll)(n - 1)*(n - 1) % MOD*(n - 1) % MOD*h[n - 3]) % MOD;
	//printf("%d %d %d^3*%d %d^3*%d -> %d\n", f[n - 1][0][0], f[n - 3][1][1], n - 1, h[n - 1], n - 1, h[n - 3], ret);
	REP(y, 2) REP(z, 2) REPE(i, n - 2 - 2 * y - 2 * z) {
		ret = (ret + (ll)(y + i + z)*(y + i + z) % MOD*(y + i + z) % MOD*h[i] % MOD*f[2 * y + z][n - i - 2 - 2 * y - 2 * z]) % MOD;
		//printf("+=%d^3*%d*%d (%d,%d,%d) -> f[%d][%d][%d]\n", y + i + z, h[i], f[n - i - 2 - 2 * y - 2 * z][y][z], i, y, z, n - i - 2 - 2 * y - 2 * z, y, z);
	}
	printf("%d\n", ret);
	fprintf(stderr, "%lf seconds.\n", 1.0*(clock() - START) / CLOCKS_PER_SEC);
}

int main() {
	run();
	return 0;
}

#include <algorithm>
#include <cstdio>

typedef long long ll;

const int mod=998244353;

const int N=3e5;

int n,lim,cnt,r[N],a[N],b[N];

int g[N],g0[N],g1[N],g2[N];

int f0[N],f1[N],f2[N];

int q0[N],q1[N];

int t1[N],t2[N],t3[N],t4[N];

inline void add(int& x,int y){
	x+=y; if(x>=mod) x-=mod;
}
inline int mul(int x,int y){
	return (ll)x*y%mod;
}

inline int fpow(int x,int k){
	int res=1;
	for(;k;k>>=1,x=mul(x,x)){
		if(k&1) res=mul(res,x);
	}
	return res;
}

inline void ntt_prepare(int len){
	for(lim=1,cnt=0;lim<len;lim<<=1,++cnt);
	for(int i=0;i<lim;++i) r[i]=(r[i>>1]>>1)|((i&1)<<(cnt-1));
}

void ntt(int *a,int op){
	for(int i=0;i<lim;++i) if(i<r[i]) std::swap(a[i],a[r[i]]);
	for(int i=1,wn;i<lim;i<<=1){
		if(op==1) wn=fpow(3,(mod-1)/(i<<1));
		else wn=fpow(3,mod-1-(mod-1)/(i<<1));
		for(int j=0;j<lim;j+=i<<1){
			int w=1;
			for(int k=0;k<i;++k,w=mul(w,wn)){
				int p=a[j+k],q=mul(w,a[j+i+k]);
				a[j+k]=(p+q)%mod; a[j+i+k]=(p+mod-q)%mod;
			}
		}
	}
	if(op==-1){
		int inv_lim=fpow(lim,mod-2);
		for(int i=0;i<lim;++i) a[i]=mul(a[i],inv_lim);
	}
}

void Convolve(int *_a,int *_b,int *_c){
	for(int i=0;i<lim/2;++i) a[i]=_a[i];
	for(int i=0;i<lim/2;++i) b[i]=_b[i];
	for(int i=lim/2;i<lim;++i) a[i]=b[i]=0;
	ntt(a,1); ntt(b,1);
	for(int i=0;i<lim;++i) _c[i]=mul(a[i],b[i]);
	ntt(_c,-1);
}

void solve_1(int l,int r){
	if(l==r){
		add(f0[l],g0[l]);
		add(f1[l],g1[l]);
		return;
	}
	int mid=(l+r)/2; solve_1(l,mid);
	ntt_prepare(2*(r-l+1));
	for(int i=0;i<lim;++i) q0[i]=(i+l<=mid?f0[i+l]:0);
	for(int i=0;i<lim;++i) q1[i]=(i+l<=mid?f1[i+l]:0);
	Convolve(g0,q0,t1); Convolve(g1,q0,t2);
	Convolve(g1,q1,t3); Convolve(g2,q1,t4);
	for(int i=0;i<lim/2;++i){
		if(mid+1<=i+l+1&&i+l+1<=r){
			add(f0[i+l+1],t1[i]); add(f1[i+l+1],t2[i]);
		}
		if(mid+1<=i+l+3&&i+l+3<=r){
			add(f0[i+l+3],t3[i]); add(f1[i+l+3],t4[i]);
		}
	}
	solve_1(mid+1,r);
}

void solve_2(int l,int r){
	if(l==r){
		add(f2[l],g2[l]);
		add(f2[l],l>=1?t1[l-1]:0);
		return;
	}
	int mid=(l+r)/2; solve_2(l,mid);
	ntt_prepare(2*(r-l+1));
	for(int i=0;i<lim;++i) q0[i]=(i+l<=mid?f2[i+l]:0);
	Convolve(g2,q0,t2);
	for(int i=0;i<lim/2;++i){
		if(mid+1-3<=i+l&&i+l<=r-3) add(f2[i+l+3],t2[i]);
	}
	solve_2(mid+1,r);
}

int main(){
	scanf("%d",&n); g[0]=1; g[2]=1;
	for(int i=4;i<=n;i+=2) g[i]=(g[i-2]+g[i-4])%mod;
	for(int i=0;i<=n;++i){
		g0[i]=mul(g[i],mul(i,i));
		g1[i]=mul(g[i],mul(i+1,i+1));
		g2[i]=mul(g[i],mul(i+2,i+2));
	}
	solve_1(0,n); ntt_prepare(2*n);
	Convolve(g1,f1,t1); solve_2(0,n);
	int ans=mul(mul((g[n-1]+g[n-3])%mod,mul(n-1,n-1)),n);
	for(int i=2;i<=n-2;++i){
		add(ans,mul(mul(mul(g[i-1],mul(i-1,i-1)),f0[n-i-1]),i));
		add(ans,mul(mul(mul(g[i-2],mul(i-1,i-1)),f1[n-i-2]),mul(2,i)));
		if(3<=i&&i<=n-3) add(ans,mul(mul(mul(g[i-3],mul(i-1,i-1)),f2[n-i-3]),i));
	}
	printf("%d\n",ans);
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
const int MAXN = 262144;
const int P = 998244353;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
template <typename T> void chkmax(T &x, T y) {x = max(x, y); }
template <typename T> void chkmin(T &x, T y) {x = min(x, y); }
template <typename T> void read(T &x) {
	x = 0; int f = 1;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	x *= f;
}
template <typename T> void write(T x) {
	if (x < 0) x = -x, putchar('-');
	if (x > 9) write(x / 10);
	putchar(x % 10 + '0');
}
template <typename T> void writeln(T x) {
	write(x);
	puts("");
}
namespace NTT {
	const int MAXN = 262144;
	const int P = 998244353;
	const int G = 3;
	int power(int x, int y) {
		if (y == 0) return 1;
		int tmp = power(x, y / 2);
		if (y % 2 == 0) return 1ll * tmp * tmp % P;
		else return 1ll * tmp * tmp % P * x % P;
	}
	int N, Log, home[MAXN];
	int forward[25], bckward[25], inv[25];
	void NTTinit() {
		for (int i = 0; i < N; i++) {
			int ans = 0, tmp = i;
			for (int j = 1; j <= Log; j++) {
				ans <<= 1;
				ans += tmp & 1;
				tmp >>= 1;
			}
			home[i] = ans;
		}
	}
	void preinit() {
		forward[0] = bckward[0] = inv[0] = 1;
		for (int len = 2, lg = 1; len <= MAXN; len <<= 1, lg++) {
			forward[lg] = power(G, (P - 1) / len);
			bckward[lg] = power(G, P - 1 - (P - 1) / len);
			inv[lg] = power(len, P - 2);
		}
	}
	void NTT(int *a, int mode) {
		for (int i = 0; i < N; i++)
			if (home[i] < i) swap(a[i], a[home[i]]);
		for (int len = 2, lg = 1; len <= N; len <<= 1, lg++) {
			int delta;
			if (mode == 1) delta = forward[lg];
			else delta = bckward[lg];
			for (int i = 0; i < N; i += len) {
				int now = 1;
				for (int j = i, k = i + len / 2; k < i + len; j++, k++) {
					int tmp = a[j];
					int tnp = 1ll * a[k] * now % P;
					a[j] = (tmp + tnp) % P;
					a[k] = (tmp - tnp + P) % P;
					now = 1ll * now * delta % P;
				}
			}
		}
		if (mode == -1) {
			for (int i = 0; i < N; i++)
				a[i] = 1ll * a[i] * inv[Log] % P;
		}
	}
	void times(int *a, int *b, int *c, int sa, int sb) {
		N = 1, Log = 0;
		while (N <= sa + sb) {
			N <<= 1;
			Log++;
		}
		for (int i = sa + 1; i < N; i++)
			a[i] = 0;
		for (int i = sb + 1; i < N; i++)
			b[i] = 0;
		NTTinit();
		NTT(a, 1);
		NTT(b, 1);
		for (int i = 0; i < N; i++)
			c[i] = 1ll * a[i] * b[i] % P;
		NTT(c, -1);
	}
}
int n, ans, fib[MAXN];
int trans[MAXN][2], dp[MAXN][2];
void update(int &x, int y) {
	x += y;
	if (x >= P) x -= P;
}
void solve(int l, int r) {
	if (l == r) return;
	int mid = (l + r) / 2;
	solve(l, mid);
	static int a[MAXN], b[MAXN], c[MAXN];
	for (int i = l; i <= mid; i++)
		a[i - l] = dp[i][0];
	for (int i = l; i <= r; i++)
		if ((i - l) % 2 == 0) b[i - l] = trans[i - l][0];
		else b[i - l] = 0;
	NTT :: times(a, b, c, mid - l, r - l);
	for (int i = mid + 1; i <= r; i++)
		update(dp[i][1], c[i - l]);

	for (int i = l; i <= mid; i++)
		a[i - l] = dp[i][0];
	for (int i = l; i <= r; i++)
		if ((i - l) % 2 == 1) b[i - l] = trans[i - l][0];
		else b[i - l] = 0;
	NTT :: times(a, b, c, mid - l, r - l);
	for (int i = mid + 1; i <= r; i++)
		update(dp[i][0], c[i - l]);

	for (int i = l; i <= mid; i++)
		a[i - l] = dp[i][1];
	for (int i = l; i <= r; i++)
		if ((i - l) % 2 == 0) b[i - l] = trans[i - l][1];
		else b[i - l] = 0;
	NTT :: times(a, b, c, mid - l, r - l);
	for (int i = mid + 1; i <= r; i++)
		update(dp[i][0], c[i - l]);

	for (int i = l; i <= mid; i++)
		a[i - l] = dp[i][1];
	for (int i = l; i <= r; i++)
		if ((i - l) % 2 == 1) b[i - l] = trans[i - l][1];
		else b[i - l] = 0;
	NTT :: times(a, b, c, mid - l, r - l);
	for (int i = mid + 1; i <= r; i++)
		update(dp[i][1], c[i - l]);
	solve(mid + 1, r);
}
int main() {
	read(n), fib[0] = fib[1] = 1, NTT :: preinit();
	for (int i = 2; i <= n; i++) {
		int tmp = i - 1;
		fib[i] = (fib[i - 1] + fib[i - 2]) % P;
		trans[i][0] = 1ll * tmp * tmp % P * fib[tmp / 2] % P;
		if (tmp & 1) trans[i][1] = 1ll * tmp * tmp % P * fib[tmp / 2] % P;
		else trans[i][1] = 1ll * tmp * tmp % P * fib[tmp / 2 - 1] % P;
	}
	memset(dp, 0, sizeof(dp)), dp[1][0] = 1, solve(1, n);
	for (int i = 1; i <= n - 1; i++) {
		int tmp = n - i;
		if (tmp & 1) update(ans, 1ll * dp[i][1] * tmp % P * tmp % P * fib[tmp / 2] % P * (n - i + 1) % P);
		else update(ans, 1ll * dp[i][0] * tmp % P * tmp % P * fib[tmp / 2] % P * (n - i + 1) % P);
	}
	memset(dp, 0, sizeof(dp)), dp[1][1] = 1, solve(1, n);
	for (int i = 1; i <= n - 1; i++) {
		int tmp = n - i;
		if (tmp & 1) update(ans, 1ll * dp[i][0] * tmp % P * tmp % P * fib[tmp / 2] % P * (n - i + 1) % P);
		else update(ans, 1ll * dp[i][1] * tmp % P * tmp % P * fib[tmp / 2 - 1] % P * (n - i + 1) % P);
	}
	writeln(ans);
	return 0;
}

//加油吧
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod=998244353,N=200200,G=3,Gi=332748118;
ll power(ll base,ll b){
	ll ret=1;
	while(b){
		if(b&1)ret=ret*base%mod;
		base=base*base%mod;
		b>>=1;
	}
	return ret;
}
int limit,len,last=-1,pos[N];
ll G0[N],G1[N],G2[N],g[N],F0[N],F1[N],F2[N];
//F0是两端都没有距离为2的点
//F1是一端有距离为2的点  (答案统计时有两种方案数相同的情况)
//F2是两端都有距离为2的点
//inline void getlen(int n){
//	limit=1,len=0;
//	while(limit<n)limit<<=1,++len;
//	if(last==limit)return;
//	last=limit;
//	for(int i=0;i<limit;++i)
//		pos[i]=(pos[i>>1]>>1)|((i&1)<<(len-1));
//}
//inline void ntt(ll *a,int n,int type){
//	for(int i=0;i<limit;++i)
//		if(i<pos[i])swap(a[i],a[pos[i]]);
//	for(int mid=1;mid<limit;mid<<=1){
//		ll wn=power((type==1?G:Gi),(mod-1)/(mid<<1));
//		for(int j=0;j<limit;j+=(mid<<=1)){
//			ll w=1;
//			for(int k=0;k<mid;++k,w=w*wn%mod){
//				ll x=a[j+k],y=a[j+mid+k]*w%mod;
//				a[j+k]=(x+y)%mod;
//				a[j+mid+k]=(x-y+mod)%mod;
//			}
//		}
//	}
//	if(type==-1){
//		ll inv=power(limit,mod-2);
//		for(int i=0;i<n;++i)a[i]=a[i]*inv%mod;
//		for(int i=n;i<limit;++i)a[i]=0;
//	}
//}
ll w[N];
void getlen(int n){
	limit=1,len=0;
	while(limit<n)limit<<=1,++len;
	w[0]=1;
	ll gg=power(G,(mod-1)/limit);
	for(int i=1;i<limit;++i){
		pos[i]=(pos[i>>1]>>1)|((i&1)<<(len-1));
		w[i]=w[i-1]*gg%mod;
	}
}
void ntt(ll *a,int n,int type){
	for(int i=0;i<limit;++i)
		if(i<pos[i])swap(a[i],a[pos[i]]);
	for(int mid=1;mid<limit;mid<<=1)
		for(int j=0,r=mid<<1;j<limit;j+=r)
			for(int k=0;k<mid;++k){
				ll x=a[j+k],y=w[limit/r*k]*a[j+mid+k]%mod;
				a[j+k]=(x+y)%mod;
				a[j+mid+k]=(x-y+mod)%mod;
			}
	if(type==-1){
		reverse(a+1,a+limit);
		ll inv=power(limit,mod-2);
		for(int i=0;i<limit;++i)a[i]=inv*a[i]%mod;
	}
}
ll f[N],h[N],tmp[N];
void calc(ll *a,int n,ll *b,int m,ll *c,int nm=-1){
	if(nm==-1)nm=n+m-1;
	getlen(nm);
	for(int i=0;i<n;++i)f[i]=a[i];
	for(int i=n;i<limit;++i)f[i]=0;
	for(int i=0;i<m;++i)h[i]=b[i];
	for(int i=m;i<limit;++i)h[i]=0;
	ntt(f,nm,1),ntt(h,nm,1);
	for(int i=0;i<limit;++i)f[i]=f[i]*h[i]%mod;
	ntt(f,nm,-1);
	for(int i=0;i<nm;++i)c[i]=f[i];
}
//void CDQ(int l,int r){
//	if(l==r){
//		F0[l]=(F0[l]+G0[l])%mod;
//		F1[l]=(F1[l]+G1[l])%mod;
//		F2[l]=(F2[l]+G2[l])%mod;
//		return;
//	}
//	int mid=(l+r)>>1;
//	CDQ(l,mid);
//	calc(F0+l,mid-l+1,G0,r-l+1,tmp+l,r-l+1);
//	for(int i=mid+1;i<=r;++i)F0[i]=(F0[i]+tmp[i])%mod;
//	calc(F0+l,mid-l+1,G1,r-l+1,tmp+l,r-l+1);
//	for(int i=mid+1;i<=r;++i)F1[i]=(F1[i]+tmp[i])%mod;
//	calc(F1+l,mid-l+1,G1,r-l+1,tmp+l,r-l+1);
//	for(int i=mid+1;i<=r;++i)F0[i]=(F0[i]+tmp[i])%mod;
//	for(int i=mid+1;i<=r;++i)F2[i]=(F2[i]+tmp[i])%mod;
//	calc(F1+l,mid-l+1,G2,r-l+1,tmp+l,r-l+1);
//	for(int i=mid+1;i<=r;++i)F1[i]=(F1[i]+tmp[i])%mod;
//	calc(F2+l,mid-l+1,G2,r-l+1,tmp+l,r-l+1);
//	for(int i=mid+1;i<=r;++i)F2[i]=(F2[i]+tmp[i])%mod;
//	//注意是左边对右边的贡献
//	CDQ(mid+1,r);
//}
void CDQ(int l, int r) {
	if (l == r) {
		F0[l] = (F0[l] + G0[l]) % mod;
		F1[l] = (F1[l] + G1[l]) % mod;
		F2[l] = (F2[l] + G2[l]) % mod;
		return ;
	}
	int mid = (l + r) >> 1;
	CDQ(l, mid);
	calc(F0 + l, mid - l + 1, G0, r - l + 1, tmp + l, r - l + 1);
	for (int i = mid + 1; i <= r; ++i) F0[i] = (F0[i] + tmp[i]) % mod;
	calc(F0 + l, mid - l + 1, G1, r - l + 1, tmp + l, r - l + 1);
	for (int i = mid + 1; i <= r; ++i) F1[i] = (F1[i] + tmp[i]) % mod;
	calc(F1 + l, mid - l + 1, G1, r - l + 1, tmp + l, r - l + 1);
	for (int i = mid + 1; i <= r; ++i) F0[i] = (F0[i] + tmp[i]) % mod;
	for (int i = mid + 1; i <= r; ++i) F2[i] = (F2[i] + tmp[i]) % mod;
	calc(F1 + l, mid - l + 1, G2, r - l + 1, tmp + l, r - l + 1);
	for (int i = mid + 1; i <= r; ++i) F1[i] = (F1[i] + tmp[i]) % mod;
	calc(F2 + l, mid - l + 1, G2, r - l + 1, tmp + l, r - l + 1);
	for (int i = mid + 1; i <= r; ++i) F2[i] = (F2[i] + tmp[i]) % mod;
	CDQ(mid + 1, r);
}
int n;
int main(){
//	freopen("y.in","r",stdin);
	scanf("%d",&n);
	g[0]=g[2]=1;
	for(int i=4;i<=n;++i)g[i]=(g[i-2]+g[i-4])%mod;
	for(int i=1;i<=n;++i)G0[i]=1LL*(i-1)*(i-1)%mod*g[i-1]%mod;
	for(int i=2;i<=n;++i)G1[i]=1LL*(i-1)*(i-1)%mod*g[i-2]%mod;
	for(int i=3;i<=n;++i)G2[i]=1LL*(i-1)*(i-1)%mod*g[i-3]%mod;
	CDQ(1,n);
	ll Ans=1LL*n*(G0[n]+G2[n])%mod;//可以旋转n次
	for(int i=2;i<=n-2;++i){
		Ans=(Ans+(G0[i]*F0[n-i]%mod+2LL*G1[i]*F1[n-i]%mod+G2[i]*F2[n-i]%mod)*(ll)i%mod)%mod;//把第一个相对的点对旋转到1-n+1处
	}
	printf("%lld\n",(Ans%mod+mod)%mod);
	return 0;
}

#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define IT iterator
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
#define debug puts("wzpakking")
#define y1 ysghysgsygsh
using namespace std;
const int mo=998244353;
const int FFTN=1<<16;
const int N=FFTN+5;
int w[N],W[N],R[N];
int A[N],B[N],C[N];
int D[N],E[N],F[N];
ull p[N];
int power(int x,int y){
	int s=1;
	for (;y;y/=2,x=1ll*x*x%mo)
		if (y&1) s=1ll*s*x%mo;
	return s;
}
void FFTinit(){
	W[0]=1;
	W[1]=power(3,(mo-1)/FFTN);
	For(i,2,N-1) W[i]=1ll*W[i-1]*W[1]%mo;
}
int FFTinit(int n){
	int L=1;
	for (;L<=n;L<<=1);
	For(i,0,L-1) R[i]=(R[i>>1]>>1)|((i&1)?(L>>1):0);
	return L;
}
void DFT(int *a,int n){
	For(i,0,n-1) p[R[i]]=a[i];
	for (int d=1;d<n;d<<=1){
		int len=FFTN/(d<<1);
		for (int i=0,j=0;i<d;i++,j+=len) w[i]=W[j];
		for (int i=0;i<n;i+=(d<<1))
			for (int j=0;j<d;j++){
				int y=p[i+j+d]*w[j]%mo;
				p[i+j+d]=p[i+j]+mo-y;
				p[i+j]+=y;
			}
	}
	For(i,0,n-1) a[i]=p[i]%mo;
}
void IDFT(int *a,int n){
	For(i,0,n-1) p[R[i]]=a[i];
	for (int d=1;d<n;d<<=1){
		int len=FFTN/(d<<1);
		for (int i=0,j=FFTN;i<d;i++,j-=len) w[i]=W[j];
		for (int i=0;i<n;i+=(d<<1))
			for (int j=0;j<d;j++){
				int y=p[i+j+d]*w[j]%mo;
				p[i+j+d]=p[i+j]+mo-y;
				p[i+j]+=y;
			}
	}
	int val=power(n,mo-2);
	For(i,0,n-1) a[i]=p[i]*val%mo;
}

int n,g[N];
int g0[N],g1[N],g2[N];
int f0[N],f1[N],f2[N];

void divide(int l,int r){
	if (l==r){
		f0[l]=(f0[l]+g0[l])%mo;
		f1[l]=(f1[l]+g1[l])%mo;
		f2[l]=(f2[l]+g2[l])%mo;
		//cout<<f0[l]<<' '<<f1[l]<<' '<<f2[l]<<endl;
		return;
	}
	int mid=(l+r)/2;
	divide(l,mid);
	int L=FFTinit(r-l+10);
	For(i,0,L-1) A[i]=B[i]=C[i]=D[i]=E[i]=F[i]=0;
	For(i,l,mid) A[i-l]=f0[i],B[i-l]=f1[i],C[i-l]=f2[i];
	For(i,0,r-l) D[i]=g0[i],E[i]=g1[i],F[i]=g2[i];
	DFT(A,L); DFT(B,L); DFT(C,L);
	DFT(D,L); DFT(E,L); DFT(F,L);
	For(i,0,L-1){
		C[i]=1ll*C[i]*F[i]%mo;
		F[i]=1ll*F[i]*B[i]%mo;
		B[i]=1ll*B[i]*E[i]%mo;
		E[i]=1ll*E[i]*A[i]%mo;
		A[i]=1ll*A[i]*D[i]%mo;
	}
	IDFT(A,L); IDFT(B,L); IDFT(C,L);
	IDFT(D,L); IDFT(E,L); IDFT(F,L);
	For(i,mid+1,r){
		f0[i]=(1ll*f0[i]+A[i-l-1]+(i>=l+3?B[i-l-3]:0))%mo;
		f1[i]=(1ll*f1[i]+E[i-l-1]+(i>=l+3?F[i-l-3]:0))%mo;
		f2[i]=(1ll*f2[i]+B[i-l-1]+(i>=l+3?C[i-l-3]:0))%mo;
	}
	divide(mid+1,r);
}
int main(){
	FFTinit();
	scanf("%d",&n);
	g[0]=1; g[2]=1;
	for (int i=4;i<=n;i+=2)
		g[i]=(g[i-2]+g[i-4])%mo;
	For(i,0,n){
		g0[i]=1ll*g[i]*i*i%mo;
		g1[i]=1ll*g[i]*(i+1)*(i+1)%mo;
		g2[i]=1ll*g[i]*(i+2)*(i+2)%mo;
	}
	//cout<<g[6]<<endl;
	/*for (int i=0;i<=n;i++){
		f0[i]=g0[i]; f1[i]=g1[i]; f2[i]=g2[i];
		for (int j=0;j<=i-1;j++){
			f0[i]=(f0[i]+1ll*f0[j]*g0[i-j-1])%mo;
			f1[i]=(f1[i]+1ll*f0[j]*g1[i-j-1])%mo;
			f2[i]=(f2[i]+1ll*f1[j]*g1[i-j-1])%mo;
		}
		for (int j=0;j<=i-3;j++){
			f0[i]=(f0[i]+1ll*f1[j]*g1[i-j-3])%mo;
			f1[i]=(f1[i]+1ll*f1[j]*g2[i-j-3])%mo;
			f2[i]=(f2[i]+1ll*f2[j]*g2[i-j-3])%mo;
		}
	}*/
	divide(0,n);
	int ans=0;
	ans=(ans+1ll*n*g0[n-1])%mo;
	//cerr<<ans<<endl;
	ans=(ans+1ll*n*g2[n-3])%mo;
	//cerr<<ans<<endl;
	For(i,0,n-2) ans=(ans+1ll*g0[i]*f0[n-i-2]%mo*(i+1))%mo;
	For(i,0,n-4) ans=(ans+2ll*g1[i]*f1[n-i-4]%mo*(i+2))%mo;
	For(i,0,n-6) ans=(ans+1ll*g2[i]*f2[n-i-6]%mo*(i+3))%mo;
	printf("%d\n",ans);
}

//加油吧
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod=998244353,N=200200,G=3,Gi=332748118;
ll power(ll base,ll b){
	ll ret=1;
	while(b){
		if(b&1)ret=ret*base%mod;
		base=base*base%mod;
		b>>=1;
	}
	return ret;
}
int limit,len,last=-1,pos[N];
ll G0[N],G1[N],G2[N],g[N],F0[N],F1[N],F2[N];
//F0是两端都没有距离为2的点
//F1是一端有距离为2的点  (答案统计时有两种方案数相同的情况)
//F2是两端都有距离为2的点
inline void getlen(int n){
	limit=1,len=0;
	while(limit<n)limit<<=1,++len;
	if(last==limit)return;
	last=limit;
	for(int i=1;i<limit;++i)
		pos[i]=(pos[i>>1]>>1)|((i&1)<<(len-1));
}
inline void ntt(ll *a,int n,int type){
	for(int i=0;i<limit;++i)
		if(i<pos[i])swap(a[i],a[pos[i]]);
	for(int mid=1;mid<limit;mid<<=1){
		ll wn=power((type==1?G:Gi),(mod-1)/(mid<<1));
		for(int j=0;j<limit;j+=(mid<<1)){
			ll w=1;
			for(int k=0;k<mid;++k,w=w*wn%mod){
				ll x=a[j+k],y=a[j+mid+k]*w%mod;
				a[j+k]=(x+y)%mod;
				a[j+mid+k]=(x-y+mod)%mod;
			}
		}
	}
	if(type==-1){
		ll inv=power(limit,mod-2);
		for(int i=0;i<n;++i)a[i]=a[i]*inv%mod;
		for(int i=n;i<limit;++i)a[i]=0;
	}
}
ll f[N],h[N],tmp[N];
void calc(ll *a,int n,ll *b,int m,ll *c,int nm=-1){
	if(nm==-1)nm=n+m-1;
	getlen(nm);
	for(int i=0;i<n;++i)f[i]=a[i];
	for(int i=n;i<limit;++i)f[i]=0;
	for(int i=0;i<m;++i)h[i]=b[i];
	for(int i=m;i<limit;++i)h[i]=0;
	ntt(f,nm,1),ntt(h,nm,1);
	for(int i=0;i<limit;++i)f[i]=f[i]*h[i]%mod;
	ntt(f,nm,-1);
	for(int i=0;i<nm;++i)c[i]=f[i];
}
void CDQ(int l,int r){
	if(l==r){
		F0[l]=(F0[l]+G0[l])%mod;
		F1[l]=(F1[l]+G1[l])%mod;
		F2[l]=(F2[l]+G2[l])%mod;
		return;
	}
	int mid=(l+r)>>1;
	CDQ(l,mid);
	calc(F0+l,mid-l+1,G0,r-l+1,tmp+l,r-l+1);
	for(int i=mid+1;i<=r;++i)F0[i]=(F0[i]+tmp[i])%mod;
	calc(F0+l,mid-l+1,G1,r-l+1,tmp+l,r-l+1);
	for(int i=mid+1;i<=r;++i)F1[i]=(F1[i]+tmp[i])%mod;
	calc(F1+l,mid-l+1,G1,r-l+1,tmp+l,r-l+1);
	for(int i=mid+1;i<=r;++i)F0[i]=(F0[i]+tmp[i])%mod;
	for(int i=mid+1;i<=r;++i)F2[i]=(F2[i]+tmp[i])%mod;
	calc(F1+l,mid-l+1,G2,r-l+1,tmp+l,r-l+1);
	for(int i=mid+1;i<=r;++i)F1[i]=(F1[i]+tmp[i])%mod;
	calc(F2+l,mid-l+1,G2,r-l+1,tmp+l,r-l+1);
	for(int i=mid+1;i<=r;++i)F2[i]=(F2[i]+tmp[i])%mod;
	//注意是左边对右边的贡献
	CDQ(mid+1,r);
}
int n;
int main(){
//	freopen("y.in","r",stdin);
	scanf("%d",&n);
	g[0]=g[2]=1;
	for(int i=4;i<=n;++i)g[i]=(g[i-2]+g[i-4])%mod;
	for(int i=1;i<=n;++i)G0[i]=1LL*(i-1)*(i-1)%mod*g[i-1]%mod;
	for(int i=2;i<=n;++i)G1[i]=1LL*(i-1)*(i-1)%mod*g[i-2]%mod;
	for(int i=3;i<=n;++i)G2[i]=1LL*(i-1)*(i-1)%mod*g[i-3]%mod;
	CDQ(1,n);
	ll Ans=1LL*n*(G0[n]+G2[n])%mod;//可以旋转n次
	for(int i=2;i<=n-2;++i){
		Ans=(Ans+(G0[i]*F0[n-i]%mod+2LL*G1[i]*F1[n-i]%mod+G2[i]*F2[n-i]%mod)*(ll)i%mod)%mod;//把第一个相对的点对旋转到1-n+1处
	}
	printf("%lld\n",(Ans%mod+mod)%mod);
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define cs const
#define re register
#define pb push_back
#define pii pair<int,int>
#define fi first
#define ll long long
#define se second
#define bg begin
cs int RLEN=(1<<20)+1;
inline char gc(){
	static char ibuf[RLEN],*ib,*ob;
	(ib==ob)&&(ob=(ib=ibuf)+fread(ibuf,1,RLEN,stdin));
	return (ib==ob)?EOF:*ib++;
}
inline int read(){
	char ch=gc();
	int res=0;bool f=1;
	while(!isdigit(ch))f^=ch=='-',ch=gc();
	while(isdigit(ch))res=res*10+(ch^48),ch=gc();
	return f?res:-res;
}
template<class tp>inline void chemx(tp&a,tp b){a<b?a=b:0;}
template<class tp>inline void chemn(tp&a,tp b){a>b?a=b:0;}
cs int mod=998244353,G=3;
inline int add(int a,int b){return (a+=b)>=mod?(a-mod):a;}
inline int dec(int a,int b){a-=b;return a+(a>>31&mod);}
inline int mul(int a,int b){static ll r;r=1ll*a*b;return (r>=mod)?(r%mod):r;}
inline void Add(int &a,int b){(a+=b)>=mod?(a-=mod):0;}
inline void Dec(int &a,int b){a-=b,a+=a>>31&mod;}
inline void Mul(int &a,int b){static ll r;r=1ll*a*b,a=(r>=mod)?(r%mod):r;}
inline int ksm(int a,int b,int res=1){for(;b;b>>=1,Mul(a,a))(b&1)&&(Mul(res,a),1);return res;}
inline int Inv(int x){return ksm(x,mod-2);}
inline int fix(int x){return (x<0)?(x+mod):x;}
typedef vector<int> poly;
cs int C=18;
int *w[C+1];
int rev[(1<<C)|1];
inline void init_rev(int lim){
	for(int i=0;i<lim;i++)rev[i]=(rev[i>>1]>>1)|((i&1)*(lim>>1));
}
inline void init_w(){
	for(int i=1;i<=C;i++)w[i]=new int[1<<(i-1)];
	int wn=ksm(G,(mod-1)/(1<<C));
	w[C][0]=1;
	for(int i=1,l=1<<(C-1);i<l;i++)w[C][i]=mul(w[C][i-1],wn);
	for(int i=C-1;i;i--)
	for(int j=0,l=1<<(i-1);j<l;j++)w[i][j]=w[i+1][j<<1];
}
inline void ntt(poly &f,int lim,int kd){
	for(int i=0;i<lim;i++)if(i>rev[i])swap(f[i],f[rev[i]]);
	for(int l=1,a0,a1,mid=1;mid<lim;mid<<=1,l++)
	for(int i=0;i<lim;i+=mid<<1)
	for(int j=0;j<mid;j++)
	a0=f[i+j],a1=mul(f[i+j+mid],w[l][j]),f[i+j]=add(a0,a1),f[i+j+mid]=dec(a0,a1);
	if(kd==-1){
		reverse(f.bg()+1,f.bg()+lim);
		for(int i=0,iv=Inv(lim);i<lim;i++)Mul(f[i],iv);
	}
}
inline poly operator +(poly a,poly b){
	a.resize(max(a.size(),b.size()));
	for(int i=0;i<b.size();i++)Add(a[i],b[i]);
	return a;
}
inline poly operator -(poly a,poly b){
	a.resize(max(a.size(),b.size()));
	for(int i=0;i<b.size();i++)Dec(a[i],b[i]);
	return a;
}
inline poly operator *(poly a,poly b){
	int deg=a.size()+b.size()-1,lim=1;
	if(deg<=32){
		poly c(deg,0);
		for(int i=0;i<a.size();i++)
		for(int j=0;j<b.size();j++)
		Add(c[i+j],mul(a[i],b[j]));
		return c;
	}
	while(lim<deg)lim<<=1;
	init_rev(lim);
	a.resize(lim),b.resize(lim);
	ntt(a,lim,1),ntt(b,lim,1);
	for(int i=0;i<lim;i++)Mul(a[i],b[i]);
	ntt(a,lim,-1),a.resize(deg);
	return a;
}
inline poly Inv(poly a,int deg){
	poly b(1,Inv(a[0])),c;
	for(int lim=4;lim<(deg<<2);lim<<=1){
		init_rev(lim);c.resize(lim>>1);
		for(int i=0;i<(lim>>1);i++)
		c[i]=(i<a.size())?a[i]:0;
		b.resize(lim),c.resize(lim);
		ntt(b,lim,1),ntt(c,lim,1);
		for(int i=0;i<lim;i++)b[i]=mul(b[i],dec(2,mul(b[i],c[i])));
		ntt(b,lim,-1),b.resize(lim>>1);
	}b.resize(deg);return b;
}
cs int N=50004;
poly g1,g2,g0,f1,f2,f0,x1,x2,x3;
int g[N],n;
inline int P(int x){return mul(x,x);}
int main(){
	#ifdef Stargazer
	freopen("lx.cpp","r",stdin);
	#endif
	n=read();init_w();
	g[0]=g[2]=1,x1.resize(2),x2.resize(3),x3.resize(4);
	x1[1]=1,x2[2]=1,x3[3]=1;
	g1.resize(n+1),g2.resize(n+1),g0.resize(n+1);
	for(int i=4;i<=n;i+=2)g[i]=add(g[i-2],g[i-4]);
	for(int i=0;i<=n;i+=2)g0[i]=mul(g[i],P(i)),g1[i]=mul(g[i],P(i+1)),g2[i]=mul(g[i],P(i+2));
	poly b=g2,c=g0,d,e;
	c.pb(0);
	for(int i=c.size()-1;i;i--)c[i]=c[i-1];
	c[0]=mod-1;//c=g0x-1
	b.resize(n+4);
	for(int i=b.size()-1;i>=3;i--)b[i]=b[i-3];
	b[2]=b[1]=0,b[0]=mod-1;//d=g2x^3-1
	d=b,b=b*c,c=g1,c.resize(n+3);
	for(int i=c.size()-1;i>1;i--)c[i]=c[i-2];
	c[1]=0,c[0]=0,c=c*c;
	b=b-c;//c=g1^2x^4
	for(int i=0;i<c.size()-2;i++)c[i]=c[i+1];
	c.pop_back();
	b=Inv(b,n+1);
	f1=g1*b;
	f0=(c-g0*d)*b;
	for(int i=0;i<d.size();i++)d[i]=dec(0,d[i]);
	d=Inv(d,n+1);
	f2=g1*f1;
	f2.pb(0);
	for(int i=f2.size()-1;i;i--)f2[i]=f2[i-1];
	f2[0]=0;
	f2=(f2+g2)*d;
//	for(int i=0;i<=n;i++)cout<<f0[i]<<" "<<f1[i]<<" "<<f2[i]<<'\n';
	int ret=mul(mul(add(g[n-1],g[n-3]),P(n-1)),n);
	for(int i=2;i<=n-2;i++){
		int now=mul(g[i-1],f0[n-i-1]);
		Add(now,mul(2,mul(g[i-2],f1[n-i-2])));
		if(i>2&&n-i>=3)Add(now,mul(g[i-3],f2[n-i-3]));
		Add(ret,mul(mul(i,P(i-1)),now));
	}
	cout<<ret;
}

// start fold
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<bitset>
using namespace std;
#define ri register int
#define il inline
#define LL long long
#define uint unsigned int
#define ull unsigned long long
#define solid const auto &
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define pll pair<LL,LL>
#define fi first
#define se second
#define gm int mid((l+r)/2)
#define enter putchar('\n')
#define rd() ({ri t;in(t);t;})
#define Size(x) ((int)x.size())
#define mem(x,y) memset(x,y,sizeof(x))
template<class T>il void in(T &x)
{
	x=0; short f=1; char c=getchar();
	while(c<'0'||c>'9')
	{
		if(c=='-') f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9') x=x*10+(c^'0'),c=getchar();
	x*=f;
}
template<class T>il void out(T x,const char c='\n')
{
	static short st[30]; short m=0;
	if(x<0) putchar('-'),x=-x;
	do st[++m]=x%10,x/=10; while(x);
	while(m) putchar(st[m--]|'0');
	putchar(c);
}
template<class T,class ...Args>il void in(T &x,Args &...args) {in(x); in(args...);}
template<class T,class ...Args>il void out(const T &x,const Args &...args) {out(x,' '); out(args...);}
template<class T>il void prt(T a[],int n) {for(ri i=0; i<n; ++i) out(a[i],' '); enter;}
template<class T>il void clr(T a[],int n) {memset(a,0,sizeof(T)*n);}
template<class T>il void clr(T *a,T *b) {memset(a,0,sizeof(T)*(b-a));}
template<class T>il bool ckmax(T &a,const T &b) {return a<b?a=b,1:0;}
template<class T>il bool ckmin(T &a,const T &b) {return a>b?a=b,1:0;}
namespace MOD_CALC
{
const int md=998244353;
il int add(const int a,const int b) {return a+b>=md?a+b-md:a+b;}
il int sub(const int a,const int b) {return a-b<0?a-b+md:a-b;}
il int mul(const int a,const int b) {return (LL)a*b%md;}
il void inc(int &a,const int b) {(a+=b)>=md?a-=md:0;}
il void dec(int &a,const int b) {(a-=b)<0?a+=md:0;}
il int qpow(int a,int b) {int r=1; for(; b; b>>=1,a=mul(a,a)) if(b&1) r=mul(r,a); return r;}
il int mdinv(const int a) {return qpow(a,md-2);}
} using namespace MOD_CALC;
namespace i207M
{
// end fold
#define N 66000*4
const int inv3=(md+1)/3;
il int qpow(int a,int b)
{
	int res=1;
	for(; b; b>>=1,a=(LL)a*a%md) if(b&1) res=(LL)res*a%md;
	return res;
}
int r[N];
void dft(int f[],int n,int op)
{
	op=(op==1)?3:inv3;
	for(ri i=0; i<n; ++i) if(i<r[i]) swap(f[i],f[r[i]]);
	for(ri p=2; p<=n; p<<=1)
	{
		int len=p>>1,nx=qpow(op,(md-1)/p);
		for(ri k=0; k<n; k+=p)
		{
			int w=1;
			for(ri i=k; i<k+len; ++i)
			{
				int t=(LL)w*f[i+len]%md;
				f[i+len]=(f[i]-t+md)%md;
				f[i]=(f[i]+t)%md;
				w=(LL)w*nx%md;
			}
		}
	}
	if(op==inv3)
	{
		int invn=qpow(n,md-2);
		for(ri i=0; i<n; ++i) f[i]=(LL)f[i]*invn%md;
	}
}
int pre(int n)
{
	int m=1; for(; m<n; m<<=1);
	for(ri i=0,hb=m>>1; i<m; ++i) r[i]=(r[i>>1]>>1)|((i&1)?hb:0);
	return m;
}
void _Inv(int n,int a[],int b[])
{
	if(n==1)
	{
		b[0]=qpow(a[0],md-2);
		return;
	}
	_Inv(n>>1,a,b);
	static int c[N];
	for(ri i=0; i<n; ++i) c[i]=a[i];
	int m=pre(n<<1);
	dft(b,m,1),dft(c,m,1);
	for(ri i=0; i<m; ++i) b[i]=(2-(LL)b[i]*c[i]%md+md)*b[i]%md;
	dft(b,m,-1);
	clr(b+n,b+m),clr(c,m);
}
void Inv(int n,int a[],int b[])
{
	int m=1; for(; m<n; m<<=1);
	_Inv(m,a,b);
	clr(b+n,b+m);
}
int Mul(int n,int a[],int m,int b[],int res[])
{
	static int c[N],d[N];
	for(ri i=0; i<n; ++i) c[i]=a[i];
	for(ri i=0; i<m; ++i) d[i]=b[i];
	int s=n+m-1,t=pre(s);
	dft(c,t,1),dft(d,t,1);
	for(ri i=0; i<t; ++i) c[i]=(LL)c[i]*d[i]%md;
	dft(c,t,-1);
	for(ri i=0; i<s; ++i) res[i]=c[i];
	clr(c,t),clr(d,t);
	return s;
}
void Mul(int n,int a[],int b[],int res[])
{
	int t=Mul(n,a,n,b,res);
	clr(res+n,res+t);
}
int n;
int g[N];
int g0[N],g1[N],g2[N];
int g12[N];
int x3g2[N],ix3g2[N];
int tmp[N];
int kf0[N],ikf0[N];
int f0[N],f1[N],f2[N];
signed main()
{
#ifdef M207
	freopen("in.in","r",stdin);
	// freopen("out.out","w",stdout);
#endif
	in(n);
	g[0]=1,g[2]=1;
	for(ri i=4; i<n; ++i) g[i]=add(g[i-2],g[i-4]);
	for(ri i=0; i<n; ++i)
	{
		g0[i]=mul(g[i],mul(i,i));
		g1[i]=mul(g[i],mul(i+1,i+1));
		g2[i]=mul(g[i],mul(i+2,i+2));
	}
	for(ri i=3; i<n; ++i) x3g2[i]=sub(0,g2[i-3]);
	x3g2[0]=1;
	Inv(n,x3g2,ix3g2);
	Mul(n,g1,g1,g12);
	for(ri i=4; i<n; ++i) tmp[i]=g12[i-4];
	Mul(n,tmp,ix3g2,kf0);
	for(ri i=0; i<n; ++i) kf0[i]=sub(0,kf0[i]);
	for(ri i=1; i<n; ++i) dec(kf0[i],g0[i-1]);
	(++kf0[0])%=md;
	Inv(n,kf0,ikf0);
	for(ri i=3; i<n; ++i) tmp[i]=g12[i-3];
	Mul(n,tmp,ix3g2,f0);
	for(ri i=0; i<n; ++i) inc(f0[i],g0[i]);
	Mul(n,f0,ikf0,f0);
	// f0 finished
	for(ri i=1; i<n; ++i) f1[i]=g1[i-1];
	Mul(n,f1,f0,f1);
	for(ri i=0; i<n; ++i) inc(f1[i],g1[i]);
	Mul(n,f1,ix3g2,f1);
	// f1 finished
	for(ri i=1; i<n; ++i) f2[i]=g1[i-1];
	Mul(n,f2,f1,f2);
	for(ri i=0; i<n; ++i) inc(f2[i],g2[i]);
	Mul(n,f2,ix3g2,f2);
	// f2 finished
	int ans=mul(mul(add(g[n-1],g[n-3]),mul(n-1,n-1)),n);
	for(ri i=2; i<=n-2; ++i)
	{
		inc(ans,mul(mul(mul(g[i-1],mul(i-1,i-1)),f0[n-i-1]),i));
		inc(ans,mul(mul(mul(g[i-2],mul(i-1,i-1)),f1[n-i-2]),mul(2,i)));
		if(i>=3&&i<=n-3) inc(ans,mul(mul(mul(g[i-3],mul(i-1,i-1)),f2[n-i-3]),i));
	}
	out(ans);
	return 0;
}
// start fold
}
signed main()
{
	i207M::main();
	return 0;
}
// end fold

#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cstdlib>
using namespace std;
#define N 50010
#define L (1<<19)+10
#define mod 998244353
#define RG register
#define LL long long
//#define int long long
int n,g[N],f0[N],f1[N],f2[N],pf[N];
inline int quick_mod(int di,int mi)
{
	RG int ret=1;
	for(;mi;mi>>=1,di=(LL)di*di%mod)
		if(mi&1)ret=(LL)ret*di%mod;
	return ret;
}
int poww[L],rev[L],bin[25],logi[L],inv[L],len=1;
inline void dft(int *a,int ra,int opt)
{
	RG int i,j,d=logi[len]-logi[ra],l,tmp,wn,*w,*x,*y;
	for(i=0;i<ra;++i)if(i<(rev[i]>>d))swap(a[i],a[rev[i]>>d]);
	for(d=2;d<=ra;d<<=1)
		for(i=0,l=(d>>1),wn=(opt==1?(len/d):(-len/d));i<ra;i+=d)
			for(j=0,x=a+i,y=x+l,w=poww+((opt==1)?0:len);j<l;++j,++x,++y,w+=wn)
				tmp=(LL)(*w)*(*y)%mod,*y=(*x+mod-tmp)%mod,*x=(*x+tmp)%mod;
	if(opt==-1)
		for(i=0;i<ra;++i)a[i]=(LL)a[i]*inv[ra]%mod;
}
int tmp1[L],tmp2[L];
inline int solve1(int l,int r)
{
	if(l==r)return 1;
	RG int i,mi=l+r>>1,ra=r-l+1,la=1,r1=solve1(l,mi);
	while(la<(ra+r1))la<<=1;
//	while(la<ra<<1)la<<=1;
//	printf("l=%d r=%d ",l,r);
//	printf("la=%d r1=%d ra=%d\n",la,r1,ra);
	for(i=0;i<r1;++i)tmp1[i]=f0[l+i];
	memset(tmp1+r1,0,la-r1<<2);dft(tmp1,la,1);
	for(i=0;i<ra;++i)tmp2[i]=(LL)g[i]*pf[i]%mod;
	memset(tmp2+ra,0,la-ra<<2);dft(tmp2,la,1);
	for(i=0;i<la;++i)tmp2[i]=(LL)tmp2[i]*tmp1[i]%mod;
	dft(tmp2,la,-1);
//	for(i=0;i<la;++i)printf("t[%d]=%d ",i,tmp2[i]);
//	printf("\n");
	for(i=mi+1;i<=r;++i)
//		printf("f0[%d]+=%d ",i,tmp2[i-l-1]),
		f0[i]=(f0[i]+tmp2[i-l-1])%mod;//printf("\n");
//	for(j=0;j<i;++j)f0[i]=(f0[i]+(LL)g[j]*pf[j]%mod*f0[i-j-1])%mod;//sum==i-1
	for(i=0;i<ra;++i)tmp2[i]=(LL)g[i]*pf[i+1]%mod;
	memset(tmp2+ra,0,la-ra<<2);dft(tmp2,la,1);
	for(i=0;i<la;++i)tmp1[i]=(LL)tmp2[i]*tmp1[i]%mod;
	dft(tmp1,la,-1);
//	for(i=0;i<la;++i)printf("t[%d]=%d ",i,tmp1[i]);
//	printf("\n");
	for(i=mi+1;i<=r;++i)
//		printf("f1[%d]+=%d ",i,tmp1[i-l-1]),
		f1[i]=(f1[i]+tmp1[i-1-l])%mod;//printf("\n");
//	for(j=0;j<i;++j)f1[i]=(f1[i]+(LL)g[j]*pf[j+1]%mod*f0[i-j-1])%mod;//sum==i-1
	for(i=0;i<r1;++i)tmp1[i]=f1[l+i];
	memset(tmp1+r1,0,la-r1<<2);dft(tmp1,la,1);
	for(i=0;i<la;++i)tmp2[i]=(LL)tmp2[i]*tmp1[i]%mod;
	dft(tmp2,la,-1);
//	for(i=0;i<la;++i)printf("t[%d]=%d ",i,tmp2[i]);
//	printf("\n");
	for(i=mi+1;i<=r;++i)if(i-l-3>=0)
//		printf("f0[%d]+=%d ",i,tmp2[i-l-3]),
		f0[i]=(f0[i]+tmp2[i-l-3])%mod;//printf("\n");
//	for(j=0;j<i-2;++j)f0[i]=(f0[i]+(LL)g[j]*pf[j+1]%mod*f1[i-j-3])%mod;//sum==i-3
	for(i=0;i<ra;++i)tmp2[i]=(LL)g[i]*pf[i+2]%mod;
	memset(tmp2+ra,0,la-ra<<2);dft(tmp2,la,1);
	for(i=0;i<la;++i)tmp2[i]=(LL)tmp2[i]*tmp1[i]%mod;
	dft(tmp2,la,-1);
//	for(i=0;i<la;++i)printf("t[%d]=%d ",i,tmp2[i]);
//	printf("\n");
	for(i=mi+1;i<=r;++i)if(i-l-3>=0)
//		printf("f1[%d]+=%d ",i,tmp2[i-l-3]),
		f1[i]=(f1[i]+tmp2[i-l-3])%mod;//printf("\n");
//	for(j=0;j<i-2;++j)f1[i]=(f1[i]+(LL)g[j]*pf[j+2]%mod*f1[i-j-3])%mod;//sum==i-3
	solve1(mi+1,r);
	return ra;
}
inline int solve2(int l,int r)
{
	if(l==r)return 1;
	RG int i,mi=l+r>>1,ra=r-l+1,la=1,r1=solve2(l,mi);
	while(la<(ra+r1))la<<=1;
//	while(la<ra<<1)la<<=1;
	for(i=0;i<r1;++i)tmp1[i]=f1[l+i];
	memset(tmp1+r1,0,la-r1<<2);dft(tmp1,la,1);
	for(i=0;i<ra;++i)tmp2[i]=(LL)g[i]*pf[i+1]%mod;
	memset(tmp2+ra,0,la-ra<<2);dft(tmp2,la,1);
	for(i=0;i<la;++i)tmp2[i]=(LL)tmp2[i]*tmp1[i]%mod;
	dft(tmp2,la,-1);
	for(i=mi+1;i<=r;++i)
		f2[i]=(f2[i]+tmp2[i-1-l])%mod;
//	for(j=0;j<i;++j)f2[i]=(f2[i]+(LL)g[j]*pf[j+1]%mod*f1[i-j-1])%mod;//sum==i-1
	for(i=0;i<r1;++i)tmp1[i]=f2[l+i];
	memset(tmp1+r1,0,la-r1<<2);dft(tmp1,la,1);
	for(i=0;i<ra;++i)tmp2[i]=(LL)g[i]*pf[i+2]%mod;
	memset(tmp2+ra,0,la-ra<<2);dft(tmp2,la,1);
	for(i=0;i<la;++i)tmp2[i]=(LL)tmp2[i]*tmp1[i]%mod;
	dft(tmp2,la,-1);
	for(i=mi+1;i<=r;++i)//if(i-l-3>=0)
		f2[i]=(f2[i]+tmp2[i-l-3])%mod;
//	for(j=0;j<i-2;++j)f2[i]=(f2[i]+(LL)g[j]*pf[j+2]%mod*f2[i-j-3])%mod;//sum==i-3
	solve2(mi+1,r);
	return ra;
}
signed main()
{
//	freopen("Ark.in","r",stdin);
//	freopen("2.out","w",stdout);
	RG int i;
	scanf("%d",&n);while(len<(n<<2))len<<=1;
//	printf("???");
	for(bin[0]=i=1;i<=20;++i)bin[i]=bin[i-1]<<1;
	for(i=0;i<=18;++i)logi[bin[i]]=i;
	for(inv[2]=((mod+1)>>1),i=2;i<=18;++i)inv[bin[i]]=(LL)inv[bin[i-1]]*inv[2]%mod;
	for(i=0;i<len;++i)
		if(i&1)rev[i]=(rev[i>>1]>>1)|(len>>1);
		else rev[i]=rev[i>>1]>>1;
	poww[0]=poww[len]=1,poww[1]=quick_mod(3,(mod-1)/len);
	for(i=2;i<len;++i)poww[i]=(LL)poww[i-1]*poww[1]%mod;

	for(i=1;i<=n+2;++i)pf[i]=(LL)i*i%mod;

	g[0]=1,g[1]=0,g[2]=1,g[3]=0;
	for(i=4;i<=n;i+=2)g[i]=(g[i-2]+g[i-4])%mod;

	f0[0]=0,f1[0]=1,f2[0]=4;
	for(i=1;i<=n;++i)
		{f0[i]=(LL)g[i]*pf[i]%mod;f1[i]=(LL)g[i]*pf[i+1]%mod;f2[i]=(LL)g[i]*pf[i+2]%mod;}

	solve1(0,n);solve2(0,n);
//	for(i=0;i<=n;++i)
//		printf("%d %d %d\n",f0[i],f1[i],f2[i]);

	RG int ans=(LL)(g[n-1]+g[n-3])*pf[n-1]%mod*n%mod;
	for(i=3;i<n;++i)ans=(ans+(LL)g[i-2]*pf[i-2]%mod*f0[n-i]%mod*(i-1))%mod;
	for(i=3;i<n;++i)ans=(ans+(LL)2*g[i-3]*pf[i-2]%mod*f1[n-i-1]%mod*(i-1))%mod;
	for(i=4;i<=n-2;++i)ans=(ans+(LL)g[i-4]*pf[i-2]%mod*f2[n-i-2]%mod*(i-1))%mod;
	printf("%d\n",ans);
}

#include <cstdio>
#include <algorithm>

typedef long long LL;
const int Mod = 998244353;
const int G = 3, iG = 332748118;
const int MS = 1 << 17;

inline int qPow(int b, int e) {
	int a = 1;
	for (; e; e >>= 1, b = (LL)b * b % Mod)
		if (e & 1) a = (LL)a * b % Mod;
	return a;
}

inline int gInv(int b) { return qPow(b, Mod - 2); }

int Inv[MS], Fac[MS], iFac[MS];

inline void Init(int N) {
	Fac[0] = 1;
	for (int i = 1; i < N; ++i) Fac[i] = (LL)Fac[i - 1] * i % Mod;
	iFac[N - 1] = gInv(Fac[N - 1]);
	for (int i = N - 1; i >= 1; --i) iFac[i - 1] = (LL)iFac[i] * i % Mod;
	for (int i = 1; i < N; ++i) Inv[i] = (LL)Fac[i - 1] * iFac[i] % Mod;
}

inline int Binom(int N, int M) {
	if (M < 0 || M > N) return 0;
	return (LL)Fac[N] * iFac[M] % Mod * iFac[N - M] % Mod;
}

int Sz, InvSz, R[MS];

inline int getB(int N) { int Bt = 0; while (1 << Bt < N) ++Bt; return Bt; }

inline void InitFNTT(int N) {
	int Bt = getB(N);
	if (Sz == (1 << Bt)) return ;
	Sz = 1 << Bt, InvSz = Mod - (Mod - 1) / Sz;
	for (int i = 1; i < Sz; ++i) R[i] = R[i >> 1] >> 1 | (i & 1) << (Bt - 1);
}

inline void FNTT(int *A, int Ty) {
	for (int i = 0; i < Sz; ++i) if (R[i] < i) std::swap(A[R[i]], A[i]);
	for (int j = 1, j2 = 2; j < Sz; j <<= 1, j2 <<= 1) {
		int wn = qPow(~Ty ? G : iG, (Mod - 1) / j2), w, X, Y;
		for (int i = 0, k; i < Sz; i += j2) {
			for (k = 0, w = 1; k < j; ++k, w = (LL)w * wn % Mod) {
				X = A[i + k], Y = (LL)w * A[i + j + k] % Mod;
				A[i + k] -= (A[i + k] = X + Y) >= Mod ? Mod : 0;
				A[i + j + k] += (A[i + j + k] = X - Y) < 0 ? Mod : 0;
			}
		}
	}
	if (!~Ty) for (int i = 0; i < Sz; ++i) A[i] = (LL)A[i] * InvSz % Mod;
}

inline void PolyConv(int *_A, int N, int *_B, int M, int *_C, int tN = -1) {
	if (tN == -1) tN = N + M - 1;
	static int A[MS], B[MS];
	InitFNTT(N + M - 1);
	for (int i = 0; i < N; ++i) A[i] = _A[i];
	for (int i = N; i < Sz; ++i) A[i] = 0;
	for (int i = 0; i < M; ++i) B[i] = _B[i];
	for (int i = M; i < Sz; ++i) B[i] = 0;
	FNTT(A, 1), FNTT(B, 1);
	for (int i = 0; i < Sz; ++i) A[i] = (LL)A[i] * B[i] % Mod;
	FNTT(A, -1);
	for (int i = 0; i < tN; ++i) _C[i] = A[i];
}

const int MN = 50005;

int N, Ans;
int g[MN];
int G0[MN], G1[MN], G2[MN];
int F0[MN], F1[MN], F2[MN];
int Tmp[MN];
void CDQ(int l, int r) {
	if (l == r) {
		F0[l] = (F0[l] + G0[l]) % Mod;
		F1[l] = (F1[l] + G1[l]) % Mod;
		F2[l] = (F2[l] + G2[l]) % Mod;
		return ;
	}
	int mid = (l + r) >> 1;
	CDQ(l, mid);
	PolyConv(F0 + l, mid - l + 1, G0, r - l + 1, Tmp + l, r - l + 1);
	for (int i = mid + 1; i <= r; ++i) F0[i] = (F0[i] + Tmp[i]) % Mod;
	PolyConv(F0 + l, mid - l + 1, G1, r - l + 1, Tmp + l, r - l + 1);
	for (int i = mid + 1; i <= r; ++i) F1[i] = (F1[i] + Tmp[i]) % Mod;
	PolyConv(F1 + l, mid - l + 1, G1, r - l + 1, Tmp + l, r - l + 1);
	for (int i = mid + 1; i <= r; ++i) F0[i] = (F0[i] + Tmp[i]) % Mod;
	for (int i = mid + 1; i <= r; ++i) F2[i] = (F2[i] + Tmp[i]) % Mod;
	PolyConv(F1 + l, mid - l + 1, G2, r - l + 1, Tmp + l, r - l + 1);
	for (int i = mid + 1; i <= r; ++i) F1[i] = (F1[i] + Tmp[i]) % Mod;
	PolyConv(F2 + l, mid - l + 1, G2, r - l + 1, Tmp + l, r - l + 1);
	for (int i = mid + 1; i <= r; ++i) F2[i] = (F2[i] + Tmp[i]) % Mod;
	CDQ(mid + 1, r);
}

int main() {
	scanf("%d", &N);
	g[2] = g[0] = 1;
	for (int i = 4; i <= N; ++i) g[i] = (g[i - 2] + g[i - 4]) % Mod;
	for (int i = 1; i <= N; ++i) G0[i] = (LL)(i - 1) * (i - 1) * g[i - 1] % Mod;
	for (int i = 2; i <= N; ++i) G1[i] = (LL)(i - 1) * (i - 1) * g[i - 2] % Mod;
	for (int i = 3; i <= N; ++i) G2[i] = (LL)(i - 1) * (i - 1) * g[i - 3] % Mod;
	CDQ(1, N);
	Ans = (LL)N * (G0[N] + G2[N]) % Mod;
	for (int i = 2; i <= N - 2; ++i)
		Ans = (Ans + ((LL)G0[i] * F0[N - i] + 2ll * G1[i] * F1[N - i] + (LL)G2[i] * F2[N - i]) % Mod * i) % Mod;
	printf("%d\n", Ans);
	return 0;
}

// Luogu : PinkRabbit

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/rope>

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= (a); i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto& a : x)

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize

const int MOD = (119 << 23) + 1, root = 3; // = 998244353
// NTT: For p < 2^30 there is also e.g. (5 << 25, 3), (7 << 26, 3),
// (479 << 21, 3) and (483 << 21, 5). The last two are > 10^9.

const ll INF = 1e18;
const int MX = 50005;
const ld PI = 4*atan((ld)1);

template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }

namespace input {
    template<class T> void re(complex<T>& x);
    template<class T1, class T2> void re(pair<T1,T2>& p);
    template<class T> void re(vector<T>& a);
    template<class T, size_t SZ> void re(array<T,SZ>& a);

    template<class T> void re(T& x) { cin >> x; }
    void re(double& x) { string t; re(t); x = stod(t); }
    void re(ld& x) { string t; re(t); x = stold(t); }
    template<class Arg, class... Args> void re(Arg& first, Args&... rest) {
        re(first); re(rest...);
    }

    template<class T> void re(complex<T>& x) { T a,b; re(a,b); x = cd(a,b); }
    template<class T1, class T2> void re(pair<T1,T2>& p) { re(p.f,p.s); }
    template<class T> void re(vector<T>& a) { F0R(i,sz(a)) re(a[i]); }
    template<class T, size_t SZ> void re(array<T,SZ>& a) { F0R(i,SZ) re(a[i]); }
}

using namespace input;

namespace output {
    template<class T1, class T2> void pr(const pair<T1,T2>& x);
    template<class T, size_t SZ> void pr(const array<T,SZ>& x);
    template<class T> void pr(const vector<T>& x);
    template<class T> void pr(const set<T>& x);
    template<class T1, class T2> void pr(const map<T1,T2>& x);

    template<class T> void pr(const T& x) { cout << x; }
    template<class Arg, class... Args> void pr(const Arg& first, const Args&... rest) {
        pr(first); pr(rest...);
    }

    template<class T1, class T2> void pr(const pair<T1,T2>& x) {
        pr("{",x.f,", ",x.s,"}");
    }
    template<class T> void prContain(const T& x) {
        pr("{");
        bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0; // const needed for vector<bool>
        pr("}");
    }
    template<class T, size_t SZ> void pr(const array<T,SZ>& x) { prContain(x); }
    template<class T> void pr(const vector<T>& x) { prContain(x); }
    template<class T> void pr(const set<T>& x) { prContain(x); }
    template<class T1, class T2> void pr(const map<T1,T2>& x) { prContain(x); }

    void ps() { pr("\n"); }
    template<class Arg> void ps(const Arg& first) {
        pr(first); ps(); // no space at end of line
    }
    template<class Arg, class... Args> void ps(const Arg& first, const Args&... rest) {
        pr(first," "); ps(rest...); // print w/ spaces
    }
}

using namespace output;

namespace io {
    void setIn(string s) { freopen(s.c_str(),"r",stdin); }
    void setOut(string s) { freopen(s.c_str(),"w",stdout); }
    void setIO(string s = "") {
        ios_base::sync_with_stdio(0); cin.tie(0); // fast I/O
        if (sz(s)) { setIn(s+".in"), setOut(s+".out"); } // for USACO
    }
}

using namespace io;

template<class T> T invGeneral(T a, T b) {
    a %= b; if (a == 0) return b == 1 ? 0 : -1;
    T x = invGeneral(b,a);
    return x == -1 ? -1 : ((1-(ll)b*x)/a+b)%b;
}

template<class T> struct modular {
    T val;
    explicit operator T() const { return val; }
    modular() { val = 0; }
    modular(const ll& v) {
        val = (-MOD <= v && v <= MOD) ? v : v % MOD;
        if (val < 0) val += MOD;
    }

    friend ostream& operator<<(ostream& os, const modular& a) { return os << a.val; }
    friend bool operator==(const modular& a, const modular& b) { return a.val == b.val; }
    friend bool operator!=(const modular& a, const modular& b) { return !(a == b); }
    friend bool operator<(const modular& a, const modular& b) { return a.val < b.val; }

    modular operator-() const { return modular(-val); }
    modular& operator+=(const modular& m) { if ((val += m.val) >= MOD) val -= MOD; return *this; }
    modular& operator-=(const modular& m) { if ((val -= m.val) < 0) val += MOD; return *this; }
    modular& operator*=(const modular& m) { val = (ll)val*m.val%MOD; return *this; }
    friend modular pow(modular a, ll p) {
        modular ans = 1; for (; p; p /= 2, a *= a) if (p&1) ans *= a;
        return ans;
    }
    friend modular inv(const modular& a) {
        auto i = invGeneral(a.val,MOD); assert(i != -1);
        return i;
    } // equivalent to return exp(b,MOD-2) if MOD is prime
    modular& operator/=(const modular& m) { return (*this) *= inv(m); }

    friend modular operator+(modular a, const modular& b) { return a += b; }
    friend modular operator-(modular a, const modular& b) { return a -= b; }
    friend modular operator*(modular a, const modular& b) { return a *= b; }

    friend modular operator/(modular a, const modular& b) { return a /= b; }
};

typedef modular<int> mi;
typedef pair<mi,mi> pmi;
typedef vector<mi> vmi;
typedef vector<pmi> vpmi;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

namespace vecOp {
    template<class T> vector<T> rev(vector<T> v) { reverse(all(v)); return v; }
    template<class T> vector<T> shift(vector<T> v, int x) { v.insert(v.begin(),x,0); return v; }

    template<class T> vector<T>& operator+=(vector<T>& l, const vector<T>& r) {
        l.rsz(max(sz(l),sz(r))); F0R(i,sz(r)) l[i] += r[i]; return l;
    }
    template<class T> vector<T>& operator-=(vector<T>& l, const vector<T>& r) {
        l.rsz(max(sz(l),sz(r))); F0R(i,sz(r)) l[i] -= r[i]; return l;
    }
    template<class T> vector<T>& operator*=(vector<T>& l, const T& r) { trav(t,l) t *= r; return l;  }
    template<class T> vector<T>& operator/=(vector<T>& l, const T& r) { trav(t,l) t /= r; return l; }

    template<class T> vector<T> operator+(vector<T> l, const vector<T>& r) { return l += r; }
    template<class T> vector<T> operator-(vector<T> l, const vector<T>& r) { return l -= r; }
    template<class T> vector<T> operator*(vector<T> l, const T& r) { return l *= r; }
    template<class T> vector<T> operator*(const T& r, const vector<T>& l) { return l*r; }
    template<class T> vector<T> operator/(vector<T> l, const T& r) { return l /= r;  }

    template<class T> vector<T> operator*(const vector<T>& l, const vector<T>& r) {
        if (min(sz(l),sz(r)) == 0) return {};
        vector<T> x(sz(l)+sz(r)-1); F0R(i,sz(l)) F0R(j,sz(r)) x[i+j] += l[i]*r[j];
        return x;
    }
    template<class T> vector<T>& operator*=(vector<T>& l, const vector<T>& r) { return l = l*r; }

    template<class T> vector<T> rem(vector<T> a,vector<T> b) {
        while (sz(b) && b.back() == 0) b.pop_back();
        assert(sz(b)); b /= b.back();
        while (sz(a) >= sz(b)) {
            a -= a.back()*shift(b,sz(a)-sz(b));
            while (sz(a) && a.back() == 0) a.pop_back();
        }
        return a;
    }
    template<class T> vector<T> interpolate(vector<pair<T,T>> v) {
        vector<T> ret;
        F0R(i,sz(v)) {
            vector<T> prod = {1};
            T todiv = 1;
            F0R(j,sz(v)) if (i != j) {
                todiv *= v[i].f-v[j].f;
                vector<T> tmp = {-v[j].f,1}; prod *= tmp;
            }
            ret += prod*(v[i].s/todiv);
        }
        return ret;
    }
}

using namespace vecOp;

namespace FFT {
    constexpr int size(int s) { return s > 1 ? 32-__builtin_clz(s-1) : 0; }
    // if vectors are small then multiply directly
    template<class T> bool small(const vector<T>& a, const vector<T>& b) { return (ll)sz(a)*sz(b) <= 500000; }

    void genRoots(vmi& roots) { // primitive n-th roots of unity
        int n = sz(roots); mi r = pow(mi(root),(MOD-1)/n);
        roots[0] = 1; FOR(i,1,n) roots[i] = roots[i-1]*r;
    }
    void genRoots(vcd& roots) { // change cd to complex<double> instead?
        int n = sz(roots); ld ang = 2*PI/n;
        F0R(i,n) roots[i] = cd(cos(ang*i),sin(ang*i)); // is there a way to do this more quickly?
    }

    template<class T> void fft(vector<T>& a, vector<T>& roots) {
        int n = sz(a);
        for (int i = 1, j = 0; i < n; i++) { // sort by reverse bit representation
            int bit = n >> 1;
            for (; j&bit; bit >>= 1) j ^= bit;
            j ^= bit; if (i < j) swap(a[i], a[j]);
        }
        for (int len = 2; len <= n; len <<= 1)
            for (int i = 0; i < n; i += len)
                F0R(j,len/2) {
                    auto u = a[i+j], v = a[i+j+len/2]*roots[n/len*j];
                    a[i+j] = u+v, a[i+j+len/2] = u-v;
                }
    }

    template<class T> vector<T> conv(vector<T> a, vector<T> b) {
        if (small(a,b)) return a*b;
        int s = sz(a)+sz(b)-1, n = 1<<size(s);
        vector<T> roots(n); genRoots(roots);

        a.rsz(n), fft(a,roots); b.rsz(n), fft(b,roots);
        F0R(i,n) a[i] *= b[i];
        reverse(begin(roots)+1,end(roots)); fft(a,roots); // inverse FFT

        T in = T(1)/T(n); trav(x,a) x *= in;
        a.rsz(s); return a;
    }
    vl conv(const vl& a, const vl& b) {
        if (small(a,b)) return a*b;
        vcd X = conv(vcd(all(a)),vcd(all(b)));
        vl x(sz(X)); F0R(i,sz(X)) x[i] = round(X[i].real());
        return x;
    } // ~0.55s when sz(a)=sz(b)=1<<19
    vl conv(const vl& a, const vl& b, ll mod) { // http://codeforces.com/contest/960/submission/37085144
        if (small(a,b)) return a*b;
        int s = sz(a)+sz(b)-1, n = 1<<size(s);

        vcd v1(n), v2(n), r1(n), r2(n);
        F0R(i,sz(a)) v1[i] = cd(a[i]>>15, a[i]&32767); // v1(x)=a0(x)+i*a1(x)
        F0R(i,sz(b)) v2[i] = cd(b[i]>>15, b[i]&32767); // v2(x)=b0(x)+i*b1(x)

        vcd roots(n); genRoots(roots);
        fft(v1,roots), fft(v2,roots);
        F0R(i,n) {
            int j = (i ? (n-i) : i);
            cd ans1 = (v1[i]+conj(v1[j]))*cd(0.5, 0); // a0(x)
            cd ans2 = (v1[i]-conj(v1[j]))*cd(0, -0.5); // a1(x)
            cd ans3 = (v2[i]+conj(v2[j]))*cd(0.5, 0); // b0(x)
            cd ans4 = (v2[i]-conj(v2[j]))*cd(0, -0.5); // b1(x)
            r1[i] = (ans1*ans3)+(ans1*ans4)*cd(0, 1); // a0(x)*v2(x)
            r2[i] = (ans2*ans3)+(ans2*ans4)*cd(0, 1); // a1(x)*v2(x)
        }
        reverse(begin(roots)+1,end(roots));
        fft(r1,roots), fft(r2,roots); F0R(i,n) r1[i] /= n, r2[i] /= n;

        vl ret(n);
        F0R(i,n) {
            ll av = (ll)round(r1[i].real()); // a0*b0
            ll bv = (ll)round(r1[i].imag())+(ll)round(r2[i].real()); // a0*b1+a1*b0
            ll cv = (ll)round(r2[i].imag()); // a1*b1
            av %= mod, bv %= mod, cv %= mod;
            ret[i] = (av<<30)+(bv<<15)+cv;
            ret[i] = (ret[i]%mod+mod)%mod;
        }
        ret.rsz(s); return ret;
    } // ~0.8s when sz(a)=sz(b)=1<<19
}

using namespace FFT;

int n;
mi g[MX], f[3][MX];

void solve(int l, int r) {
	if (l == r) {
		f[0][l] += g[l]*l*l;
		f[1][l] += g[l]*(l+1)*(l+1);
		f[2][l] += g[l]*(l+2)*(l+2);
		return;
	}
	int m = (l+r)/2;
	solve(l,m);
	vmi F[3];
	F0R(i,3) FOR(j,l,m+1) F[i].pb(f[i][j]);

	///////// f[0]
	// g[j]*j*j is coefficient for j+1, combine with f[0]
	{
		vmi v(r-l+1);
		F0R(j,r-l+1-1) v[j+1] = g[j]*j*j;
		v = conv(v,F[0]);
		FOR(j,m+1,r+1) f[0][j] += v[j-l];
	}
    // g[j]*(j+1)*(j+1) is coefficient for j+3, combine with f[1]
	{
		vmi v(r-l+1);
		F0R(j,r-l+1-3) v[j+3] = g[j]*(j+1)*(j+1);
		v = conv(v,F[1]);
		FOR(j,m+1,r+1) f[0][j] += v[j-l];
	}

	///////// f[1]
	{
		vmi v(r-l+1);
		F0R(j,r-l+1-1) v[j+1] = g[j]*(j+1)*(j+1);
		v = conv(v,F[0]);
		FOR(j,m+1,r+1) f[1][j] += v[j-l];
	}
	{
		vmi v(r-l+1);
		F0R(j,r-l+1-3) v[j+3] = g[j]*(j+2)*(j+2);
		v = conv(v,F[1]);
		FOR(j,m+1,r+1) f[1][j] += v[j-l];
	}
	///////// f[2]
	{
		vmi v(r-l+1);
		F0R(j,r-l+1-1) v[j+1] = g[j]*(j+1)*(j+1);
		v = conv(v,F[1]);
		FOR(j,m+1,r+1) f[2][j] += v[j-l];
	}
	{
		vmi v(r-l+1);
		F0R(j,r-l+1-3) v[j+3] = g[j]*(j+2)*(j+2);
		v = conv(v,F[2]);
		FOR(j,m+1,r+1) f[2][j] += v[j-l];
	}
	solve(m+1,r);
}

int main() {
    setIO(); re(n);
    g[0] = 1;
    FOR(i,2,MX) {
    	g[i] = g[i-2];
    	if (i >= 4) g[i] += g[i-4];
    }
    solve(0,n);
    mi ans = 0;
    FOR(i,1,n+1) {
    	mi tot = 0;
    	if (1 <= i && i <= n-1) tot += g[i-1]*f[0][n-1-i];
    	if (2 <= i && i <= n-2) tot += 2*g[i-2]*f[1][n-2-i];
    	if (3 <= i && i <= n-3) tot += g[i-3]*f[2][n-3-i];
    	if (i == n) tot += (g[i-1]+g[i-3]);
    	ans += tot*i*(i-1)*(i-1);
    }
    ps(ans);
}

/* stuff you should look for
    * int overflow, array bounds
    * special cases (n=1?), set tle
    * do smth instead of nothing and stay organized
*/

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <cmath>
#include <set>
#include <map>
#include <cstdio>
#include <stdlib.h>
#include <stack>
#include <numeric>
#include <bitset>
#include <cctype>
#include <list>
#include <assert.h>
#include <random>
#include <unordered_map>
#include <ctime>
typedef  long long ll;
using namespace std;
#define INF 2147483647
#define infL (1LL<<60)
#define inf (1<<30)
#define inf9 (1000000000)
#define MOD 1000000007
#define EPS 1e-9
#define Gr 9.8
#define PI acos(-1)
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define REQ(i,n) for(int (i)=1;(i)<=(int)(n);(i)++)
#define lch (rt<<1)
#define rch (rt<<1|1)
#define readmp(n) for(int i=0,u,v;i<n;i++) {scanf("%d%d",&u,&v); mp[u].push_back(v); mp[v].push_back(u);}
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ld;
typedef unsigned int uint;
#define MAX 140125
bool debug = 0;
int n,m,k;
int dx[4] = {0,1,0,-1}, dy[4] = {1,0,-1,0};
string direc="RDLU";
ll ln, lk, lm;
void etp(bool f = 0) {
    puts(f ?"YES" : "NO");
    exit(0);
}
void addmod(int &x, int y, int mod = MOD) {
    assert(y>=0);
    x+=y; if (x>=mod) x-=mod;
    assert(x>=0 && x<mod);
}
void et() {
    puts("-1"); exit(0);
}
ll fastPow(ll x, ll y, int mod=MOD) {
    ll ans = 1;
    while(y>0) {
        if(y&1) ans = (x * ans)%mod;
        x = x*x%mod;
        y>>=1;
    }
    return ans;
}

const int P = 998244353,Gi = 332748118;
int r[20][MAX],L,limit=1, Inv[20];
bool vis[20];
void init(int n, int m) {
    L=0; limit=1;
    while (limit <= n+m) {
        limit<<=1; L++;
    }
    if (vis[L]) return;
    vis[L]=1;
    Inv[L] = fastPow(limit, P-2, P);
    REP(i,limit) r[L][i] = (r[L][i >> 1] >> 1) | ((i & 1) << (L - 1));
}
void NTT(vector<int> &A, int type) {
    for(int i = 0; i < limit; i++)
        if(i < r[L][i]) swap(A[i], A[r[L][i]]);
    for(int mid = 1; mid < limit; mid <<= 1) {
        ll Wn = fastPow(type == 1 ? 3 : Gi , (P - 1) / (mid << 1), P);
        for(int j = 0; j < limit; j += (mid << 1)) {
            ll w = 1;
            for(int k = 0; k < mid; k++, w = (w * Wn) % P) {
                int x = A[j + k], y = w * A[j + k + mid] % P;
                A[j + k] = (x + y) % P;
                A[j + k + mid] = (x - y + P) % P;
            }
        }
    }
}

int g[MAX], G[3][MAX], F[3][MAX];
vector<int> res,A,B;
void wk(int *a, int N, int *b, int M) {
    init(N, M);
    REP(i,limit) {
        if (i<N) A[i]=a[i];
        else A[i]=0;
        if(i<M) B[i]=b[i];
        else B[i]=0;
    }
    NTT(A,1); NTT(B,1);
    REP(i,limit) res[i] = ((ll)A[i]*B[i])%P;
    NTT(res, -1);
    REP(i, limit) res[i] = (ll)res[i]*Inv[L]%P;
}
void cal(int l, int r){
    if (l==r) {
        REP(j,3) addmod(F[j][l], G[j][l], P);
        return;
    }
    int mid = (l+r)/2;
    cal(l,mid);
    wk(F[0]+l, mid-l+1, G[0]+1, r-l);
    for(int i=mid+1;i<=r;i++) addmod(F[0][i], res[i-l-1], P);
    wk(F[0]+l, mid-l+1, G[1]+1, r-l);
    for(int i=mid+1;i<=r;i++) addmod(F[1][i], res[i-l-1], P);
    wk(F[1]+l, mid-l+1, G[1]+1, r-l);
    for(int i=mid+1;i<=r;i++) addmod(F[0][i], res[i-l-1], P);
    for(int i=mid+1;i<=r;i++) addmod(F[2][i], res[i-l-1], P);

    wk(F[1]+l, mid-l+1, G[2]+1, r-l);
    for(int i=mid+1;i<=r;i++) addmod(F[1][i], res[i-l-1],P);
    wk(F[2]+l, mid-l+1, G[2]+1, r-l);
    for(int i=mid+1;i<=r;i++) addmod(F[2][i], res[i-l-1],P);
    cal(mid+1,r);
}
void fmain(int tid) {
    scanf("%d",&n);
    g[2]=1; g[0]=1;
    for(int i=4;i<=n;i+=2) g[i]=(g[i-2]+g[i-4])%P;
    for(int i=1;i<=n;i++) G[0][i] =(ll)g[i-1]*(i-1)*(i-1)%P;
    for(int i=2;i<=n;i++) G[1][i] =(ll)g[i-2]*(i-1)*(i-1)%P;
    for(int i=3;i<=n;i++) G[2][i] =(ll)g[i-3]*(i-1)*(i-1)%P;
    res.resize(MAX, 0);
    A.resize(MAX,0);
    B.resize(MAX,0);
    cal(1,n);
    int ans = (ll)n*(G[0][n]+G[2][n])%P;
    for(int i=2;i<=n-2;i++) {
        addmod(ans,
               ((ll)G[0][i]*F[0][n-i]%P + (ll)G[1][i]*F[1][n-i]*2%P + (ll)G[2][i]*F[2][n-i])%P * i %P, P);
    }
    printf("%d\n", ans);
}
int main() {
    int t=1;
//    scanf("%d", &t);
    REQ(i,t) {
        fmain(i);
    }
    return 0;
}

#include<cstdio>
#include<iostream>
using namespace std;

const int P=998244353,N=3e5;
int n,L,C,r[N],A[N],B[N];
int g[N],g0[N],g1[N],g2[N];
int f0[N],f1[N],f2[N];
int q0[N],q1[N];
int t1[N],t2[N],t3[N],t4[N];

inline void Add(int& x,int y){ x+=y; if(x>=P) x-=P; }
inline int Mul(int x,int y){ return 1ll*x*y%P; }
inline int fpow(int x,int k){
	int s=1;
	for(;k;k>>=1,x=Mul(x,x)) if(k&1) s=Mul(s,x);
	return s;
}

inline void NTT_prepare(int len){
	for(L=1,C=0;L<len;L<<=1,++C);
	for(int i=0;i<L;++i) r[i]=(r[i>>1]>>1)|((i&1)<<(C-1));
}

void NTT(int *A,int op){
	for(int i=0;i<L;++i) if(i<r[i]) swap(A[i],A[r[i]]);
	for(int i=1;i<L;i<<=1){
		int Wn=fpow(3,(P-1)/(i<<1));
		if(op==-1) Wn=fpow(Wn,P-2);
		for(int j=0;j<L;j+=i<<1){
			int w=1;
			for(int k=0;k<i;++k,w=Mul(w,Wn)){
				int p=A[j+k],q=Mul(w,A[j+i+k]);
				A[j+k]=(p+q)%P; A[j+i+k]=((p-q)%P+P)%P;
			}
		}
	}
	if(op==-1){
		int inv_L=fpow(L,P-2);
		for(int i=0;i<L;++i) A[i]=Mul(A[i],inv_L);
	}
}

void Convolve(int *a,int *b,int *C){
	for(int i=0;i<L/2;++i) A[i]=a[i];
	for(int i=0;i<L/2;++i) B[i]=b[i];
	for(int i=L/2;i<L;++i) A[i]=B[i]=0;
	NTT(A,1); NTT(B,1);
	for(int i=0;i<L;++i) C[i]=Mul(A[i],B[i]);
	NTT(C,-1);
}

void Solve_1(int l,int r){
	if(l==r){
		Add(f0[l],g0[l]);
		Add(f1[l],g1[l]);
		return;
	}
	int mid=(l+r)/2;
	Solve_1(l,mid);
	NTT_prepare(2*(r-l+1));
	for(int i=0;i<L;++i) q0[i]=(i+l<=mid?f0[i+l]:0);
	for(int i=0;i<L;++i) q1[i]=(i+l<=mid?f1[i+l]:0);
	Convolve(g0,q0,t1);
	Convolve(g1,q0,t2);
	Convolve(g1,q1,t3);
	Convolve(g2,q1,t4);
	for(int i=0;i<L/2;++i){
		if(mid+1<=i+l+1&&i+l+1<=r){
			Add(f0[i+l+1],t1[i]);
			Add(f1[i+l+1],t2[i]);
		}
		if(mid+1<=i+l+3&&i+l+3<=r){
			Add(f0[i+l+3],t3[i]);
			Add(f1[i+l+3],t4[i]);
		}
	}
	Solve_1(mid+1,r);
}

void Solve_2(int l,int r){
	if(l==r){
		Add(f2[l],g2[l]);
		Add(f2[l],l>=1?t1[l-1]:0);
		return;
	}
	int mid=(l+r)/2;
	Solve_2(l,mid);
	NTT_prepare(2*(r-l+1));
	for(int i=0;i<L;++i) q0[i]=(i+l<=mid?f2[i+l]:0);
	Convolve(g2,q0,t2);
	for(int i=0;i<L/2;++i){
		if(mid+1-3<=i+l&&i+l<=r-3){
			Add(f2[i+l+3],t2[i]);
		}
	}
	Solve_2(mid+1,r);
}

int main(){
	scanf("%d",&n); g[0]=1; g[2]=1;
	for(int i=4;i<=n;i+=2) g[i]=(g[i-2]+g[i-4])%P;
	for(int i=0;i<=n;++i){
		g0[i]=Mul(g[i],Mul(i,i));
		g1[i]=Mul(g[i],Mul(i+1,i+1));
		g2[i]=Mul(g[i],Mul(i+2,i+2));
	}
	Solve_1(0,n);
	NTT_prepare(2*n);
	Convolve(g1,f1,t1);
	Solve_2(0,n);
	int ans=Mul(Mul((g[n-1]+g[n-3])%P,Mul(n-1,n-1)),n);
	for(int i=2;i<=n-2;++i){
		Add(ans,Mul(Mul(Mul(g[i-1],Mul(i-1,i-1)),f0[n-i-1]),i));
		Add(ans,Mul(Mul(Mul(g[i-2],Mul(i-1,i-1)),f1[n-i-2]),Mul(2,i)));
		if(3<=i&&i<=n-3) Add(ans,Mul(Mul(Mul(g[i-3],Mul(i-1,i-1)),f2[n-i-3]),i));
	}
	printf("%d\n",ans);
	return 0;
}

#include <bits/stdc++.h>
#define MAXN 1<<17
using namespace std;

const long long MOD = 998244353LL;
const long long G = 3LL;

long long a[MAXN], b[MAXN], invn;
int n, m, L, rev[MAXN];
long long f[MAXN][2][2], g[MAXN], h[MAXN][2], ans;

inline long long fpow(long long a, long long b)
{
	long long r = 1;
	for (; b; b >>= 1, (a *= a) %= MOD) if (b & 1) (r *= a) %= MOD;
	return r;
}

inline void NTT(long long c[], int n, int f)
{
	long long w, wn, x, y;
	for (int i = 0; i < n; i++)
		if (i < rev[i]) swap(c[i], c[rev[i]]);
	for (int i = 1; i < n; i <<= 1)
	{
		wn = fpow(G, (MOD - 1) / (i << 1));
		if (!~f) wn = fpow(wn, MOD - 2);
		for (int p = i << 1, j = 0; j < n; j += p)
		{
			w = 1LL;
			for (int k = 0; k < i; k++, w = w * wn % MOD)
			{
				x = c[j + k];
				y = c[j + k + i] * w % MOD;
				c[j + k] = (x + y) % MOD;
				c[j + k + i] = (x - y + MOD) % MOD;
			}
		}
	}
	if (!~f)
		for (int i = 0; i < n; i++) c[i] = c[i] * invn % MOD;
	return ;
}

inline void NTT_Prepare(int n)
{
	for (m = 1, L = 0; m <= (n << 1); L++, m <<= 1);
	for (int i = 0; i < m; i++) a[i] = b[i] = 0;
	invn = fpow(m, MOD - 2);
	for (int i = 0; i < m; i++) rev[i] = (rev[i >> 1] >> 1) | ((i & 1) << (L - 1));
	return ;
}

inline void NTT_Work()
{
	NTT(a, m, 1); NTT(b, m, 1);
	for (int i = 0; i < m; i++) a[i] = (a[i] * b[i]) % MOD;
	NTT(a, m, -1);
	return ;
}

void DP(int l, int r, int m, int x, int y)
{
	NTT_Prepare(r - l + 1);
	for (int i = l; i <= m; i++) a[i - l] = h[i][x];
	for (int i = 0; i <= r - l; i++) b[i] = f[i][x][y];
	NTT_Work();
	for (int i = m + 1; i <= r; i++) h[i][y] = (h[i][y] + a[i - l]) % MOD;
	return ;
}

inline void DC(int l, int r)
{
	if (l == r) return ;
	int m = l + r >> 1;
	DC(l, m);
	for (int i = 0; i <= 1; i++)
		for (int j = 0; j <= 1; j++)
			DP(l, r, m, i, j);
	DC(m + 1, r);
	return ;
}

int main()
{
	scanf("%d", &n);
	g[0] = 1;
	for (int i = 1; i <= n; i++) g[i] = ((i < 2 ? 0 : g[i - 2]) + (i < 4 ? 0 : g[i - 4])) % MOD;
	for (int i = 1; i <= n; i++)
		for (int j = 0; j <= 1; j++)
			for (int k = 0; k <= 1; k++)
				f[i][j][k] = (i - 1 - j - k >= 0) ? g[i - 1 - j - k] * (i - 1) % MOD * (i - 1) % MOD: 0;
	h[0][0] = 1;
	DC(0, n - 1);
	for (int i = 0; i < n; i++)
		for (int v = 0; v <= 1; v++)
			ans = (ans + h[i][v] * f[n - i][v][0] % MOD * (n - i)) % MOD;
	memset(h, 0, sizeof h);
	h[0][1] = 1;
	DC(0, n - 1);
	for (int i = 0; i < n; i++)
		for (int v = 0; v <= 1; v++)
			ans = (ans + h[i][v] * f[n - i][v][1] % MOD * (n - i)) % MOD;
	printf("%lld\n", ans);
	return 0;
}

#include <bits/stdc++.h>

const int N = 131072;
const int mod = 998244353;
using LL = long long;
int n;
int g[N], g0[N], g1[N], g2[N], f0[N], f1[N], f2[N];
void reduce(int &x) { x += x >> 31 & mod; }
int pow(int x, int y, int ans = 1) {
	for (; y; y >>= 1, x = (LL) x * x % mod)
		if (y & 1) ans = (LL) ans * x % mod;
	return ans;
}
int lim, s, rev[N], w[N], wn[N];
void fftinit(int len) {
	wn[0] = lim = 1, s = -1; while (lim < len) lim <<= 1, ++s;
	for (int i = 0; i < lim; ++i) rev[i] = rev[i >> 1] >> 1 | (i & 1) << s;
	const int g = pow(3, (mod - 1) / lim);
	for (int i = 1; i < lim; ++i) wn[i] = (LL) wn[i - 1] * g % mod;
}
void fft(int *A, int typ) {
	for (int i = 0; i < lim; ++i) if (i < rev[i]) std::swap(A[i], A[rev[i]]);
	for (int i = 1; i < lim; i <<= 1) {
		for (int j = 0, t = lim / i / 2; j < i; ++j) w[j] = wn[j * t];
		for (int j = 0; j < lim; j += i << 1)
			for (int k = 0; k < i; ++k) {
				const int x = A[k + j], y = (LL) A[k + j + i] * w[k] % mod;
				reduce(A[k + j] += y - mod), reduce(A[k + j + i] = x - y);
			}
	}
	if (!typ) {
		const int il = pow(lim, mod - 2);
		for (int i = 0; i < lim; ++i) A[i] = (LL) A[i] * il % mod;
		std::reverse(A + 1, A + lim);
	}
}
void multiply(int *a, int n, int *b, int m, int *ret, int len) {
	static int A[N], B[N];
	fftinit(n + m - 1);
	std::memcpy(A, a, n << 2), std::memset(A + n, 0, lim - n << 2);
	std::memcpy(B, b, m << 2), std::memset(B + m, 0, lim - m << 2);
	fft(A, 1), fft(B, 1);
	for (int i = 0; i < lim; ++i) A[i] = (LL) A[i] * B[i] % mod;
	fft(A, 0), std::memcpy(ret, A, len << 2);
}
void solve(int l, int r) {
	if (l + 1 == r) return;
	int mid = l + r + 1 >> 1;
	solve(l, mid);
	static int a00[N], a10[N], a11[N], a21[N], a22[N];
	multiply(g0, r - l, f0 + l, mid - l, a00 + l, r - l);
	multiply(g1, r - l, f0 + l, mid - l, a10 + l, r - l);
	multiply(g1, r - l, f1 + l, mid - l, a11 + l, r - l);
	multiply(g2, r - l, f1 + l, mid - l, a21 + l, r - l);
	multiply(g2, r - l, f2 + l, mid - l, a22 + l, r - l);
	for (int i = std::max(mid, 1); i < r; ++i) if (i - 1 >= l) reduce(f0[i] += a00[i - 1] - mod);
	for (int i = std::max(mid, 3); i < r; ++i) if (i - 3 >= l) reduce(f0[i] += a11[i - 3] - mod);
	for (int i = std::max(mid, 1); i < r; ++i) if (i - 1 >= l) reduce(f1[i] += a10[i - 1] - mod);
	for (int i = std::max(mid, 3); i < r; ++i) if (i - 3 >= l) reduce(f1[i] += a21[i - 3] - mod);
	for (int i = std::max(mid, 1); i < r; ++i) if (i - 1 >= l) reduce(f2[i] += a11[i - 1] - mod);
	for (int i = std::max(mid, 3); i < r; ++i) if (i - 3 >= l) reduce(f2[i] += a22[i - 3] - mod);
	solve(mid, r);
}
int main() {
	std::ios::sync_with_stdio(0), std::cin.tie(0);
	std::cin >> n;
	g[0] = 1, g[2] = 1;
	for (int i = 4; i < n; i += 2)
		reduce(g[i] = g[i - 2] + g[i - 4] - mod);
	for (int i = 0; i < n; ++i) {
		g0[i] = (LL) g[i] * i % mod * i % mod;
		g1[i] = (LL) g[i] * (i + 1) % mod * (i + 1) % mod;
		g2[i] = (LL) g[i] * (i + 2) % mod * (i + 2) % mod;
	}
	for (int i = 0; i < n; ++i)
		f0[i] = g0[i], f1[i] = g1[i], f2[i] = g2[i];
	solve(0, n);
	int ans = (LL) (g0[n - 1] + g2[n - 3]) * n % mod;
	for (int i = 3; i < n; ++i) {
		reduce(ans += (LL) g0[i - 2] * f0[n - i] % mod * (i - 1) % mod - mod);
		reduce(ans += 2LL * g1[i - 3] * f1[n - i - 1] % mod * (i - 1) % mod - mod);
		if (i >= 4 && i <= n - 2) reduce(ans += (LL) g2[i - 4] * f2[n - i - 2] % mod * (i - 1) % mod - mod);
	}
	std::cout << ans << '\n';
	return 0;
}

#include <bits/stdc++.h>
using namespace std;

using Poly = vector<int>;

const int P = 998244353;

Poly operator+(Poly lhs, Poly rhs) {
	Poly ret(max(lhs.size(), rhs.size()), 0);
	for (int i = 0; i < ret.size(); i++) ret[i] = ((i < lhs.size() ? lhs[i] : 0) + (i < rhs.size() ? rhs[i] : 0)) % P;
	return ret;
}

Poly operator-(Poly lhs, Poly rhs) {
	Poly ret(max(lhs.size(), rhs.size()), 0);
	for (int i = 0; i < ret.size(); i++) ret[i] = ((i < lhs.size() ? lhs[i] : 0) + (i < rhs.size() ? P - rhs[i] : 0)) % P;
	return ret;
}

Poly operator*(Poly lhs, Poly rhs) {
	Poly ret(max(0, (int)(lhs.size() + rhs.size()) - 1), 0);
	for (int i = 0; i < lhs.size(); i++) {
		for (int j = 0; j < rhs.size(); j++) {
			ret[i+j] = (ret[i+j] + lhs[i] * 1LL * rhs[j]) % P;
		}
	}
	return ret;
}

Poly operator*(Poly lhs, int rhs) {
	for (int &x : lhs) x = x * 1LL * rhs % P;
	return lhs;
}

Poly s(Poly p, int k) {
	Poly q(k, 0); p.insert(p.begin(), q.begin(), q.end());
	return p;
}

Poly dot(Poly p) {
	for (int i = 0; i < p.size(); i++) p[i] = 1LL * i * p[i] % P;
	return p;
}

int calc(Poly &a) {
	reverse(a.begin(), a.end());
	int ret = 0;
	while (!a.empty() && !a.back()) a.pop_back(), ret++;
	reverse(a.begin(), a.end());
	return ret;
}

int solve(Poly a, Poly b, int n) {
	n -= calc(a) - calc(b);
	if (n < 0) return 0;
	vector<int> c(n + 1, 0);
	for (int i = 0; i <= n; i++) {
		c[i] = i < a.size() ? a[i] : 0;
		for (int j = 1; j < b.size() && j <= i; j++) c[i] = (c[i] + (P - c[i - j]) * 1LL * b[j]) % P;
	}
	return c[n];
}

int main() {
	int n; cin >> n;
	Poly A = {1, 0, P-1, 0, P-1}, B = dot(A), C = dot(B);
	Poly F0 = B * B * 2 - C * A, F1 = F0 + A * A - B * A * 2, F2 = F1 + A * A * 3 - B * A * 2;
	F0 = A * A * A - s(F0, 1), F1 = s(F1, 2), F2 = A * A * A - s(F2, 3);
	Poly F = F0 * F2 - F1 * F1;
	cout << (solve(B, A, n) * 6LL + P - solve(dot(F), F, n)) % P << endl;
	return 0;
}

// luogu-judger-enable-o2
#include<cstdio>
#include<iostream>
using namespace std;

const int P=998244353,N=3e5;
int n,L,C,r[N],A[N],B[N];
int g[N],g0[N],g1[N],g2[N];
int f0[N],f1[N],f2[N];
int q0[N],q1[N];
int t1[N],t2[N],t3[N],t4[N];

inline void Add(int& x,int y){ x+=y; if(x>=P) x-=P; }
inline int Mul(int x,int y){ return 1ll*x*y%P; }
inline int fpow(int x,int k){
	int s=1;
	for(;k;k>>=1,x=Mul(x,x)) if(k&1) s=Mul(s,x);
	return s;
}

inline void NTT_prepare(int len){
	for(L=1,C=0;L<len;L<<=1,++C);
	for(int i=0;i<L;++i) r[i]=(r[i>>1]>>1)|((i&1)<<(C-1));
}

void NTT(int *A,int op){
	for(int i=0;i<L;++i) if(i<r[i]) swap(A[i],A[r[i]]);
	for(int i=1;i<L;i<<=1){
		int Wn=fpow(3,(P-1)/(i<<1));
		if(op==-1) Wn=fpow(Wn,P-2);
		for(int j=0;j<L;j+=i<<1){
			int w=1;
			for(int k=0;k<i;++k,w=Mul(w,Wn)){
				int p=A[j+k],q=Mul(w,A[j+i+k]);
				A[j+k]=(p+q)%P; A[j+i+k]=((p-q)%P+P)%P;
			}
		}
	}
	if(op==-1){
		int inv_L=fpow(L,P-2);
		for(int i=0;i<L;++i) A[i]=Mul(A[i],inv_L);
	}
}

void Convolve(int *a,int *b,int *C){
	for(int i=0;i<L/2;++i) A[i]=a[i];
	for(int i=0;i<L/2;++i) B[i]=b[i];
	for(int i=L/2;i<L;++i) A[i]=B[i]=0;
	NTT(A,1); NTT(B,1);
	for(int i=0;i<L;++i) C[i]=Mul(A[i],B[i]);
	NTT(C,-1);
}

void Solve_1(int l,int r){
	if(l==r){
		Add(f0[l],g0[l]);
		Add(f1[l],g1[l]);
		return;
	}
	int mid=(l+r)/2;
	Solve_1(l,mid);
	NTT_prepare(2*(r-l+1));
	for(int i=0;i<L;++i) q0[i]=(i+l<=mid?f0[i+l]:0);
	for(int i=0;i<L;++i) q1[i]=(i+l<=mid?f1[i+l]:0);
	Convolve(g0,q0,t1);
	Convolve(g1,q0,t2);
	Convolve(g1,q1,t3);
	Convolve(g2,q1,t4);
	for(int i=0;i<L/2;++i){
		if(mid+1<=i+l+1&&i+l+1<=r){
			Add(f0[i+l+1],t1[i]);
			Add(f1[i+l+1],t2[i]);
		}
		if(mid+1<=i+l+3&&i+l+3<=r){
			Add(f0[i+l+3],t3[i]);
			Add(f1[i+l+3],t4[i]);
		}
	}
	Solve_1(mid+1,r);
}

void Solve_2(int l,int r){
	if(l==r){
		Add(f2[l],g2[l]);
		Add(f2[l],l>=1?t1[l-1]:0);
		return;
	}
	int mid=(l+r)/2;
	Solve_2(l,mid);
	NTT_prepare(2*(r-l+1));
	for(int i=0;i<L;++i) q0[i]=(i+l<=mid?f2[i+l]:0);
	Convolve(g2,q0,t2);
	for(int i=0;i<L/2;++i){
		if(mid+1-3<=i+l&&i+l<=r-3){
			Add(f2[i+l+3],t2[i]);
		}
	}
	Solve_2(mid+1,r);
}

int main(){
	scanf("%d",&n); g[0]=1; g[2]=1;
	for(int i=4;i<=n;i+=2) g[i]=(g[i-2]+g[i-4])%P;
	for(int i=0;i<=n;++i){
		g0[i]=Mul(g[i],Mul(i,i));
		g1[i]=Mul(g[i],Mul(i+1,i+1));
		g2[i]=Mul(g[i],Mul(i+2,i+2));
	}
	Solve_1(0,n);
	NTT_prepare(2*n);
	Convolve(g1,f1,t1);
	Solve_2(0,n);
	int ans=Mul(Mul((g[n-1]+g[n-3])%P,Mul(n-1,n-1)),n);
	for(int i=2;i<=n-2;++i){
		Add(ans,Mul(Mul(Mul(g[i-1],Mul(i-1,i-1)),f0[n-i-1]),i));
		Add(ans,Mul(Mul(Mul(g[i-2],Mul(i-1,i-1)),f1[n-i-2]),Mul(2,i)));
		if(3<=i&&i<=n-3) Add(ans,Mul(Mul(Mul(g[i-3],Mul(i-1,i-1)),f2[n-i-3]),i));
	}
	printf("%d\n",ans);
	return 0;
}

#include <bits/stdc++.h>
using namespace std;

const int N = 55000;
const int MOD = 998244353;

int modExp(int a, int n, int p) {
	int ret = 1;
	for (; n; n >>= 1, a = 1LL * a * a % p) if (n & 1) ret = 1LL * ret * a % p;
	return ret;
}

using VI = vector<int>;

VI operator+(VI lhs, VI rhs) {
	VI ret(max(lhs.size(), rhs.size()), 0);
	for (int i = 0; i < ret.size(); i++) ret[i] = ((i < lhs.size() ? lhs[i] : 0) + (i < rhs.size() ? rhs[i] : 0)) % MOD;
	return ret;
}

VI operator-(VI lhs, VI rhs) {
	VI ret(max(lhs.size(), rhs.size()), 0);
	for (int i = 0; i < ret.size(); i++) ret[i] = ((i < lhs.size() ? lhs[i] : 0) + (i < rhs.size() ? MOD - rhs[i] : 0)) % MOD;
	return ret;
}

VI operator*(VI lhs, VI rhs) {
	VI ret((int)lhs.size() + rhs.size() - 1, 0);
	for (int i = 0; i < lhs.size(); i++) {
		for (int j = 0; j < rhs.size(); j++) {
			ret[i + j] = (ret[i + j] + lhs[i] * 1LL * rhs[j]) % MOD;
		}
	}
	return ret;
}

VI dot(VI &a) {
	if (a.size() == 1) { return {0}; }
	VI ret(a.size() - 1, 0);
	for (int i = 0; i < ret.size(); i++) ret[i] = a[i+1] * 1LL * (i+1) % MOD;
	return ret;
}

VI operator*(VI a, int k) {
	VI ret(a.size(), 0);
	for (int i = 0; i < a.size(); i++) ret[i] = a[i] * 1LL * k % MOD;
	return ret;
}

struct GF {
	VI p, q; // p/q
	GF(VI p = VI(), VI q = VI()) : p(p), q(q) {}
	GF operator+(GF rhs) {
		return GF(p * rhs.q + q * rhs.p, q * rhs.q);
	}
	GF operator-(GF rhs) {
		return GF(p * rhs.q - q * rhs.p, q * rhs.q);
	}
	GF operator*(int k) {
		return GF(p * k, q);
	}
} e[3], E[3], g, h, x, xx, yy, z, y;

GF operator*(GF lhs, GF rhs) {
	return GF(lhs.p * rhs.p, lhs.q * rhs.q);
}

GF dot(GF &g) {
	return GF(dot(g.p) * g.q - dot(g.q) * g.p, g.q * g.q);
}

GF inv(GF &g) {
	return GF(g.q, g.p);
}

int a[N], b[N], c[N];

void extract(GF y, int n) {
	b[0] = 1;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j < y.q.size(); j++) {
			if (j > i) break;
			b[i] = (b[i] + 1LL * (MOD - y.q[j]) * b[i - j]) % MOD;
		}
	}
	for (int i = n; i >= 0; i--) {
		for (int j = 0; j < y.p.size(); j++) {
			if (j > i) break;
			a[i] = (a[i] + 1LL * b[i - j] * y.p[j]) % MOD;
		}
	}
}

int main() {
	int n; scanf("%d", &n);
	e[0] = GF({1}, {1, 0, MOD-1, 0, MOD-1});
	e[1] = dot(e[0]) * GF({0, 1}, {1});
	e[2] = dot(e[1]) * GF({0, 1}, {1});
	E[0] = e[2];
	E[1] = e[2] + e[1] * 2 + e[0];
	E[2] = e[2] + e[1] * 4 + e[0] * 4;
	g = GF({1}, {1}) - GF({0, 1}, {1}) * E[0];
	g = inv(g) * E[1];
	h = g * E[1];
	h = h * GF({0, 1}, {1});
	h = h + E[2];
	x = h * GF({0, 0, 0, 1}, {1});
	xx = dot(x);
	yy = GF({1}, {1}) - x;
	yy = inv(yy);
	z = yy * xx;
	y = GF({0}, {1});
	y = y + z * GF({0, 1}, {1});
	x = E[0] * GF({0, 1}, {1});
	xx = dot(x);
	yy = GF({1}, {1}) - x;
	yy = inv(yy);
	z = yy * xx;
	y = y + z * GF({0, 1}, {1});
	extract(y, n);
	cout << a[n] << endl;
	return 0;
}

#include <cstdio>
#include <vector>
#include <algorithm>

const int P=998244353;
inline int mul(const int &a,const int &b){return 1ll*a*b%P;}
inline int sub(int a,const int &b){a-=b;return (a<0)?a+P:a;}
inline int add(int a,const int &b){a+=b;return(a>=P)?a-P:a;}
typedef std::vector<int> poly;
poly operator*(poly a,poly b){
	int size=a.size()+b.size()-1;
	poly c(size);
	for(int i=0;i<a.size();i++)
		for(int j=0;j<b.size();j++)
			c[i+j]=add(c[i+j],mul(a[i],b[j]));
	return c;
}
poly operator+(poly a,poly b){
	if(a.size()<b.size())a.resize(b.size());
	for(int i=0;i<b.size();i++)a[i]=add(a[i],b[i]);
	return a;
}
poly operator-(poly a,poly b){
	if(a.size()<b.size())a.resize(b.size());
	for(int i=0;i<b.size();i++)a[i]=sub(a[i],b[i]);
	return a;
}
poly diff(poly a){
	for(int i=0;i<a.size()-1;i++)a[i]=mul(a[i+1],i+1);
	a.pop_back();
	return a;
}
poly lift(poly a,int n){
	a.resize(a.size()+n);
	for(int i=a.size()-1;i>=n;i--)a[i]=a[i-n];
	for(int i=0;i<n;i++)a[i]=0;
	return a;
}
struct fract{
	poly a,b;
	fract operator*(fract c){return (fract){a*c.a,b*c.b};}
	fract operator+(fract c){return (fract){a*c.b+b*c.a,b*c.b};}
	fract diff(){return (fract){::diff(a)*b-::diff(b)*a,b*b};}
	fract sum(){return (fract){b,b-a};}
	void print(){
		for(int i=0;i<a.size();i++)printf("%d ",a[i]);putchar('\n');
		for(int i=0;i<b.size();i++)printf("%d ",b[i]);putchar('\n');
	}
}fib,H,C,tem,ans;
fract get(fract f){
	f=f.diff();
	f.a=lift(f.a,1);
	f=f.diff();
	f.a=lift(f.a,1);
	return f;
}
int f[50001];
int getval(int n,fract ans){
	f[0]=1;
	for(int i=1;i<=n;i++){
		f[i]=0;
		for(int j=1;j<ans.b.size();j++)
			if(i-j>=0)f[i]=sub(f[i],mul(f[i-j],ans.b[j]));
	}
	int Ans=0;
	for(int i=0;i<ans.a.size()&&n-i>=0;i++)Ans=add(Ans,mul(ans.a[i],f[n-i]));
	return Ans;
}
int main(){
	fib.a.push_back(1);
	fib.b.push_back(1);
	fib.b.push_back(0);
	fib.b.push_back(P-1);
	fib.b.push_back(0);
	fib.b.push_back(P-1);
//	for(int i=0;i<6;i++)printf("%d ",getval(i,fib));putchar('\n');
	tem=get(fib);
	tem.a=lift(tem.a,1);
	C=tem;
	fib.a=lift(fib.a,1);
	tem=get(fib);
	tem.a=lift(tem.a,1);
	fib.a=lift(fib.a,1);
	H=get(fib);
	H.a=lift(H.a,1);
	C=C+H.sum()*tem*tem;
	ans=H.diff()*H.sum()+C.diff()*C.sum();
	int n;
	scanf("%d",&n);
	printf("%d\n",getval(n-1,ans));
}

#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define per(i, a, b) for (int i = a; i >= b; i--)
using namespace std;

typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef long long ll;

template <typename _T>
inline void read(_T &f) {
    f = 0; _T fu = 1; char c = getchar();
    while (c < '0' || c > '9') { if (c == '-') { fu = -1; } c = getchar(); }
    while (c >= '0' && c <= '9') { f = (f << 3) + (f << 1) + (c & 15); c = getchar(); }
    f *= fu;
}

template <typename T>
void print(T x) {
    if (x < 0) putchar('-'), x = -x;
    if (x < 10) putchar(x + 48);
    else print(x / 10), putchar(x % 10 + 48);
}

template <typename T>
void print(T x, char t) {
    print(x); putchar(t);
}

const int N = 50005, md = 998244353;

inline int add(int x, int y) {
    x += y;
    if (x >= md) x -= md;
    return x;
}

inline int sub(int x, int y) {
    x -= y;
    if (x < 0) x += md;
    return x;
}

inline int mul(int x, int y) { return 1ll * x * y % md; }

inline int fpow(int x, int y) {
    int ans = 1;
    while (y) {
        if (y & 1) ans = mul(ans, x);
        y >>= 1; x = mul(x, x);
    }
    return ans;
}

namespace Poly {
    vector <int> roots, rev;

    void getRevRoot(int base) {
        int n = 1 << base;
        if ((int)roots.size() == n) return;
        roots.resize(n); rev.resize(n);
        for (int i = 1; i < n; i++) rev[i] = (rev[i >> 1] >> 1) | ((i & 1) << (base - 1));
        for (int mid = 1; mid < n; mid <<= 1) {
            int wn = fpow(3, (md - 1) / (mid << 1));
            roots[mid] = 1;
            for (int i = 1; i < mid; i++) roots[i + mid] = mul(roots[i + mid - 1], wn);
        }
    }

    void ntt(vector <int> &a, int base) {
        int n = 1 << base;
        for (int i = 1; i < n; i++) {
            if (i < rev[i]) {
                swap(a[i], a[rev[i]]);
            }
        }
        for (int mid = 1; mid < n; mid <<= 1) {
            for (int i = 0; i < n; i += (mid << 1)) {
                for (int j = 0; j < mid; j++) {
                    int x = a[i + j], y = mul(a[i + j + mid], roots[mid + j]);
                    a[i + j] = add(x, y); a[i + j + mid] = sub(x, y);
                }
            }
        }
    }

    vector <int> operator * (vector <int> a, vector <int> b) {
        int n = (int)a.size() + (int)b.size() - 1, base = 0;
        while ((1 << base) < n) ++base;
        a.resize(1 << base); b.resize(1 << base);
        getRevRoot(base); ntt(a, base); ntt(b, base);
        for (int i = 0; i < (1 << base); i++) a[i] = mul(a[i], b[i]);
        reverse(a.begin() + 1, a.end()); ntt(a, base); a.resize(n);
        int inv = fpow(1 << base, md - 2);
        for (int i = 0; i < n; i++) a[i] = mul(a[i], inv);
        return a;
    }
}

using Poly::operator *;

vector <int> f0, f1, f2, g0, g1, g2, tmp;
int F0[N], F1[N], F2[N], G0[N], G1[N], G2[N], g[N];
int n, ans;

void cdq(int l, int r) {
    if (l == r) {
        F0[l] = add(F0[l], G0[l]);
        F1[l] = add(F1[l], G1[l]);
        F2[l] = add(F2[l], G2[l]);
        return;
    }
    int mid = (l + r) >> 1;
    cdq(l, mid);
    f0.resize(mid - l + 1); f1.resize(mid - l + 1); f2.resize(mid - l + 1);
    for (int i = l; i <= mid; i++) {
        f0[i - l] = F0[i];
        f1[i - l] = F1[i];
        f2[i - l] = F2[i];
    }
    g0.resize(r - l + 1); g1.resize(r - l + 1); g2.resize(r - l + 1);
    for (int i = 0; i <= r - l; i++) {
        g0[i] = G0[i];
        g1[i] = G1[i];
        g2[i] = G2[i];
    }
    tmp = f0 * g0;
    for (int i = mid - l + 1; i <= r - l; i++) F0[i + l] = add(F0[i + l], tmp[i]);
    tmp = f0 * g1;
    for (int i = mid - l + 1; i <= r - l; i++) F1[i + l] = add(F1[i + l], tmp[i]);
    tmp = f1 * g1;
    for (int i = mid - l + 1; i <= r - l; i++) F0[i + l] = add(F0[i + l], tmp[i]);
    for (int i = mid - l + 1; i <= r - l; i++) F2[i + l] = add(F2[i + l], tmp[i]);
    tmp = f1 * g2;
    for (int i = mid - l + 1; i <= r - l; i++) F1[i + l] = add(F1[i + l], tmp[i]);
    tmp = f2 * g2;
    for (int i = mid - l + 1; i <= r - l; i++) F2[i + l] = add(F2[i + l], tmp[i]);
    cdq(mid + 1, r);
}

int main() {
    read(n);
    g[0] = 1;
    for (int i = 2; i <= n; i += 2) {
        g[i] = g[i - 2];
        if (i >= 4) g[i] = add(g[i], g[i - 4]);
    }
    for (int i = 1; i <= n; i++) G0[i] = mul(g[i - 1], mul(i - 1, i - 1));
    for (int i = 2; i <= n; i++) G1[i] = mul(g[i - 2], mul(i - 1, i - 1));
    for (int i = 3; i <= n; i++) G2[i] = mul(g[i - 3], mul(i - 1, i - 1));
    cdq(1, n);
    ans = mul(n, add(G0[n], G2[n]));
    for (int i = 0; i <= n; i++) {
        int res = 0;
        res = add(res, mul(F0[i], G0[n - i]));
        res = add(res, mul(2, mul(F1[i], G1[n - i])));
        res = add(res, mul(F2[i], G2[n - i]));
        ans = add(ans, mul(res, n - i));
    }
    print(ans, '\n');
    return 0;
}

#include<bits/stdc++.h>

typedef long long ll;
typedef unsigned long long ull;

using namespace std;

const int MAXN=262144<<1;
const int P=998244353;
const int g[]={3,(P+1)/3};

int rev[MAXN],n;
ll tp[MAXN],itp[MAXN],tp2[MAXN],itp2[MAXN];
ll _G_[2][MAXN],G[MAXN],G0[MAXN],G1[MAXN],G2[MAXN],X1[MAXN],X3[MAXN],X4[MAXN],F0[MAXN],F1[MAXN],F2[MAXN];

ll Add(ll a,ll b){a+=b;return a>=P?a-P:a;}

ll Sub(ll a,ll b){a-=b;return a<0?a+P:a;}

void Inc(ll &a,ll b){a+=b;if(a>=P) a-=P;}

void Dec(ll &a,ll b){a-=b;if(a<0) a+=P;}

ll ksm(ll a,ll b)
{
	ll ret=1;
	for(;b;b>>=1,(a*=a)%=P) if(b&1) (ret*=a)%=P;
	return ret;
}

int init(int n)
{
	int tot=1,lg2=0;
	while(tot<=n) tot<<=1,lg2++;
	for(int i=0;i<tot;i++) rev[i]=(rev[i>>1]>>1)|((i&1)<<(lg2-1));
	return tot;
}

void NTT(ll *a,int n,int f)
{
	ll *ed=a+n;
	for(int i=0;i<n;i++)
		if(i>rev[i]) swap(a[i],a[rev[i]]);
	for(int i=2;i<=n;i<<=1)
		for(ll *x=a,*y=a+(i>>1);x!=ed;x+=i,y+=i)
			for(int k=0;k<(i>>1);k++)
			{
				ll u=x[k],t=y[k]*_G_[f][k*MAXN/i]%P;
				x[k]=Add(u,t);y[k]=Sub(u,t);
			}
	if(f) for(int i=0,inv=ksm(n,P-2);i<n;i++) a[i]=a[i]*inv%P;
}

void Inv(ll *a,ll *Res,int n)
{
    if(n==1) return Res[0]=ksm(a[0],P-2),void();
    Inv(a,Res,(n+1)>>1);
    int tot=init(n<<1),lst=(n+1)>>1;
    static ll t1[MAXN],t2[MAXN];
    memset(t1,0,sizeof(ll)*tot);memset(t2,0,sizeof(ll)*tot);
    for(int i=0;i<n;i++) t1[i]=a[i];
    for(int i=0;i<lst;i++) t2[i]=Res[i];
    NTT(t1,tot,0);NTT(t2,tot,0);
    for(int i=0;i<tot;i++) t1[i]=Sub(2*t2[i],t2[i]*t2[i]%P*t1[i]%P);
    NTT(t1,tot,1);
    for(int i=0;i<n;i++) Res[i]=t1[i];
}

int main()
{
	_G_[0][0]=_G_[1][0]=1;
	_G_[0][1]=ksm(g[0],(P-1)/MAXN);_G_[1][1]=ksm(g[1],(P-1)/MAXN);
	for(int i=2;i<MAXN;i++) _G_[0][i]=_G_[0][i-1]*_G_[0][1]%P,_G_[1][i]=_G_[1][i-1]*_G_[1][1]%P;
	scanf("%d",&n);G[0]=1;
	int tot=init(4*n);//notice
	for(int i=2;i<=n;i++) G[i]=Add(G[i-2],i>3?G[i-4]:0);
	for(int i=0;i<=n;i++) G0[i]=G[i]*i%P*i%P,G1[i]=G[i]*(i+1)%P*(i+1)%P,G2[i]=G[i]*(i+2)%P*(i+2)%P;
	X1[1]=1;X3[3]=1;X4[4]=1;
	NTT(G0,tot,0);NTT(G1,tot,0);NTT(G2,tot,0);NTT(X1,tot,0);NTT(X3,tot,0);NTT(X4,tot,0);
	for(int i=0;i<tot;i++) tp[i]=Sub(Add(X4[i]*G2[i]%P*G0[i]%P,1),Add(X1[i]*G0[i]%P,Add(X3[i]*G2[i]%P,X4[i]*G1[i]%P*G1[i]%P)));
	for(int i=0;i<tot;i++) tp2[i]=Sub(1,X3[i]*G2[i]%P);
	NTT(tp2,tot,1);Inv(tp2,itp2,n);
	init(4*n);NTT(itp2,tot,0);
	NTT(tp,tot,1);Inv(tp,itp,n);
	init(4*n);NTT(itp,tot,0);
	for(int i=0;i<tot;i++) F0[i]=Add(G0[i]*Sub(1,X3[i]*G2[i]%P)%P,X3[i]*G1[i]%P*G1[i]%P)*itp[i]%P;
	for(int i=0;i<tot;i++) F1[i]=Add(G1[i]*Sub(1,X1[i]*G0[i]%P)%P,X1[i]*G1[i]%P*G0[i]%P)*itp[i]%P;
	for(int i=0;i<tot;i++) F2[i]=Add(G2[i],X1[i]*F1[i]%P*G1[i]%P)*itp2[i]%P;
	NTT(F0,tot,1);NTT(F1,tot,1);NTT(F2,tot,1);
	ll Ans=Add(G[n-1],G[n-3])*(n-1)%P*(n-1)%P*n%P;
	for(int i=2;i<=n-2;i++)
	{
		Inc(Ans,G[i-1]*(i-1)%P*(i-1)%P*F0[n-i-1]%P*i%P);
		Inc(Ans,G[i-2]*(i-1)%P*(i-1)%P*F1[n-i-2]%P*i%P*2%P);
		if(i>=3&&i<=n-3) Inc(Ans,G[i-3]*(i-1)%P*(i-1)%P*F2[n-i-3]%P*i%P);
	}
	printf("%lld\n",Ans);
}

#include<cstdio>
#include<algorithm>
using std::swap;
using std::max;
#define maxn 65536
typedef long long ll;

const int mod=998244353,wg=3,ig=332748118;
int r[maxn],a[maxn],b[maxn],squre[50002],f0[50000],f1[50000],f2[50000];
int g[50002]={1,0,1,0},g0[50000],g1[50000],g2[50000];
int *w,len,inv,wn[maxn]={1},iwn[maxn]={1};
int pow(int x,int p)
{
    int res(1);
    while(p)
    {
        if(p&1) res=1ll*res*x%mod;
        x=1ll*x*x%mod;
        p>>=1;
    }
    return res;
}
void ntt(int* t,int* ow=wn)
{
    for(int i(0);i<len;++i)
    {
        if(i<r[i]) swap(t[i],t[r[i]]);
    }
    for(int i(1),j(2),step(len>>1);i<len;i<<=1,j<<=1,step>>=1)
    {
        for(int k(0);k<len;k+=j)
        {
            w=ow;
            for(int l(k);l<k+i;++l,w+=step)
            {
                int tmp(1ll*(*w)*t[l+i]%mod);
                t[l+i]=t[l]-tmp;
                if(t[l+i]<0) t[l+i]+=mod;
                t[l]+=tmp;
                if(t[l]>=mod) t[l]-=mod;
            }
        }
    }
    if(ow==iwn)
    {
        for(int i(0);i<len;++i) t[i]=1ll*t[i]*inv%mod;
    }
}
void get_f(int lo,int hi)
{
    if(hi==lo+1)
    {
        f0[lo]=(f0[lo]+g0[lo])%mod;
        f1[lo]=(f1[lo]+g1[lo])%mod;
        f2[lo]=(f2[lo]+g2[lo])%mod;
    }
    else
    {
        int mi((lo+hi)>>1);
        get_f(lo,mi);
        int tmp(hi-lo),ti(max(lo+3,mi));len=1;
        while(len<tmp) len<<=1;
        inv=mod-(mod-1)/len;
        for(int i(0);i<len;++i) r[i]=(r[i>>1]|((i&1)?len:0))>>1;
        for(int i(1),j(pow(wg,(mod-1)/len));i<len;++i) wn[i]=1ll*wn[i-1]*j%mod;
        for(int i(1),j(pow(ig,(mod-1)/len));i<len;++i) iwn[i]=1ll*iwn[i-1]*j%mod;
        for(int i(0);i<=tmp-2;++i) a[i]=g0[i];
        for(int i(lo);i<mi;++i) b[i-lo]=f0[i];
        ntt(a);ntt(b);
        for(int i(0);i<len;++i) a[i]=1ll*a[i]*b[i]%mod;
        ntt(a,iwn);
        for(int i(mi);i<hi;++i) f0[i]=(f0[i]+a[i-1-lo])%mod;
        for(int i(0);i<=tmp-2;++i) a[i]=g1[i];
        for(int i(tmp-1);i<len;++i) a[i]=0;
        ntt(a);for(int i(0);i<len;++i) b[i]=1ll*a[i]*b[i]%mod;
        ntt(b,iwn);
        for(int i(mi);i<hi;++i) f1[i]=(f1[i]+b[i-1-lo])%mod;
        for(int i(lo);i<mi;++i) b[i-lo]=f1[i];
        for(int i(mi-lo);i<len;++i) b[i]=0;
        ntt(b);
        for(int i(0);i<len;++i) a[i]=1ll*a[i]*b[i]%mod;
        ntt(a,iwn);
        for(int i(mi);i<hi;++i) f2[i]=(f2[i]+a[i-1-lo])%mod;
        for(int i(ti);i<hi;++i) f0[i]=(f0[i]+a[i-3-lo])%mod;
        for(int i(0);i<=tmp-2;++i) a[i]=g2[i];
        for(int i(tmp-1);i<len;++i) a[i]=0;
        ntt(a);
        for(int i(0);i<len;++i) b[i]=1ll*a[i]*b[i]%mod;
        ntt(b,iwn);
        for(int i(ti);i<hi;++i) f1[i]=(f1[i]+b[i-3-lo])%mod;
        for(int i(lo);i<mi;++i) b[i-lo]=f2[i];
        for(int i(mi-lo);i<len;++i) b[i]=0;
        ntt(b);
        for(int i(0);i<len;++i) a[i]=1ll*a[i]*b[i]%mod;
        ntt(a,iwn);
        for(int i(ti);i<hi;++i) f2[i]=(f2[i]+a[i-3-lo])%mod;
        for(int i(0);i<len;++i) a[i]=b[i]=0;
        get_f(mi,hi);
    }
}
int main()
{
    int n,ans;scanf("%d",&n);
    for(int i(4);i<=n+1;++i) g[i]=(g[i-2]+g[i-4])%mod;
    for(int i(0);i<=n+1;++i) squre[i]=1ll*i*i%mod;
    for(int i(0);i<n;++i)
    {
        g0[i]=1ll*g[i]*squre[i]%mod;
        g1[i]=1ll*g[i]*squre[i+1]%mod;
        g2[i]=1ll*g[i]*squre[i+2]%mod;
    }
    get_f(0,n);
    ans=1ll*g[n+1]*squre[n-1]%mod*n%mod;
    for(int i(2);i<=n-2;++i)
        ans=(1ll*i*squre[i-1]%mod*((1ll*g[i-1]*f0[n-1-i]+1ll*2*g[i-2]*f1[n-i-2])%mod)+ans)%mod;
    for(int i(3);i<=n-3;++i)
        ans=(1ll*i*squre[i-1]%mod*g[i-3]%mod*f2[n-i-3]+ans)%mod;
    printf("%d",ans);
    return 0;
}

#include <cstdio>
#include <algorithm>

typedef long long LL;
const int Mod = 998244353;
const int G = 3, iG = 332748118;
const int MS = 1 << 17;

inline int qPow(int b, int e) {
	int a = 1;
	for (; e; e >>= 1, b = (LL)b * b % Mod)
		if (e & 1) a = (LL)a * b % Mod;
	return a;
}

inline int gInv(int b) { return qPow(b, Mod - 2); }

int Inv[MS], Fac[MS], iFac[MS];

inline void Init(int N) {
	Fac[0] = 1;
	for (int i = 1; i < N; ++i) Fac[i] = (LL)Fac[i - 1] * i % Mod;
	iFac[N - 1] = gInv(Fac[N - 1]);
	for (int i = N - 1; i >= 1; --i) iFac[i - 1] = (LL)iFac[i] * i % Mod;
	for (int i = 1; i < N; ++i) Inv[i] = (LL)Fac[i - 1] * iFac[i] % Mod;
}

inline int Binom(int N, int M) {
	if (M < 0 || M > N) return 0;
	return (LL)Fac[N] * iFac[M] % Mod * iFac[N - M] % Mod;
}

int Sz, InvSz, R[MS];

inline int getB(int N) { int Bt = 0; while (1 << Bt < N) ++Bt; return Bt; }

inline void InitFNTT(int N) {
	int Bt = getB(N);
	if (Sz == (1 << Bt)) return ;
	Sz = 1 << Bt, InvSz = Mod - (Mod - 1) / Sz;
	for (int i = 1; i < Sz; ++i) R[i] = R[i >> 1] >> 1 | (i & 1) << (Bt - 1);
}

inline void FNTT(int *A, int Ty) {
	for (int i = 0; i < Sz; ++i) if (R[i] < i) std::swap(A[R[i]], A[i]);
	for (int j = 1, j2 = 2; j < Sz; j <<= 1, j2 <<= 1) {
		int wn = qPow(~Ty ? G : iG, (Mod - 1) / j2), w, X, Y;
		for (int i = 0, k; i < Sz; i += j2) {
			for (k = 0, w = 1; k < j; ++k, w = (LL)w * wn % Mod) {
				X = A[i + k], Y = (LL)w * A[i + j + k] % Mod;
				A[i + k] -= (A[i + k] = X + Y) >= Mod ? Mod : 0;
				A[i + j + k] += (A[i + j + k] = X - Y) < 0 ? Mod : 0;
			}
		}
	}
	if (!~Ty) for (int i = 0; i < Sz; ++i) A[i] = (LL)A[i] * InvSz % Mod;
}

inline void PolyConv(int *_A, int N, int *_B, int M, int *_C, int tN = -1) {
	if (tN == -1) tN = N + M - 1;
	static int A[MS], B[MS];
	InitFNTT(N + M - 1);
	for (int i = 0; i < N; ++i) A[i] = _A[i];
	for (int i = N; i < Sz; ++i) A[i] = 0;
	for (int i = 0; i < M; ++i) B[i] = _B[i];
	for (int i = M; i < Sz; ++i) B[i] = 0;
	FNTT(A, 1), FNTT(B, 1);
	for (int i = 0; i < Sz; ++i) A[i] = (LL)A[i] * B[i] % Mod;
	FNTT(A, -1);
	for (int i = 0; i < tN; ++i) _C[i] = A[i];
}

const int MN = 50005;

int N, Ans;
int g[MN];
int G0[MN], G1[MN], G2[MN];
int F0[MN], F1[MN], F2[MN];
int Tmp[MN];
void CDQ(int l, int r) {
	if (l == r) {
		F0[l] = (F0[l] + G0[l]) % Mod;
		F1[l] = (F1[l] + G1[l]) % Mod;
		F2[l] = (F2[l] + G2[l]) % Mod;
		return ;
	}
	int mid = (l + r) >> 1;
	CDQ(l, mid);
	PolyConv(F0 + l, mid - l + 1, G0, r - l + 1, Tmp + l, r - l + 1);
	for (int i = mid + 1; i <= r; ++i) F0[i] = (F0[i] + Tmp[i]) % Mod;
	PolyConv(F0 + l, mid - l + 1, G1, r - l + 1, Tmp + l, r - l + 1);
	for (int i = mid + 1; i <= r; ++i) F1[i] = (F1[i] + Tmp[i]) % Mod;
	PolyConv(F1 + l, mid - l + 1, G1, r - l + 1, Tmp + l, r - l + 1);
	for (int i = mid + 1; i <= r; ++i) F0[i] = (F0[i] + Tmp[i]) % Mod;
	for (int i = mid + 1; i <= r; ++i) F2[i] = (F2[i] + Tmp[i]) % Mod;
	PolyConv(F1 + l, mid - l + 1, G2, r - l + 1, Tmp + l, r - l + 1);
	for (int i = mid + 1; i <= r; ++i) F1[i] = (F1[i] + Tmp[i]) % Mod;
	PolyConv(F2 + l, mid - l + 1, G2, r - l + 1, Tmp + l, r - l + 1);
	for (int i = mid + 1; i <= r; ++i) F2[i] = (F2[i] + Tmp[i]) % Mod;
	CDQ(mid + 1, r);
}

int main() {
	scanf("%d", &N);
	g[2] = g[0] = 1;
	for (int i = 4; i <= N; ++i) g[i] = (g[i - 2] + g[i - 4]) % Mod;
	for (int i = 1; i <= N; ++i) G0[i] = (LL)(i - 1) * (i - 1) * g[i - 1] % Mod;
	for (int i = 2; i <= N; ++i) G1[i] = (LL)(i - 1) * (i - 1) * g[i - 2] % Mod;
	for (int i = 3; i <= N; ++i) G2[i] = (LL)(i - 1) * (i - 1) * g[i - 3] % Mod;
	CDQ(1, N);
	Ans = (LL)N * (G0[N] + G2[N]) % Mod;
	for (int i = 2; i <= N - 2; ++i)
		Ans = (Ans + i * ((LL)G0[i] * F0[N - i] + 2ll * G1[i] * F1[N - i] + (LL)G2[i] * F2[N - i])) % Mod;
	printf("%d\n", Ans);
	return 0;
}

// Luogu : PinkRabbit

#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define per(i, a, b) for(int i=(b)-1; i>=(a); i--)
#define sz(a) (int)a.size()
#define de(a) cout << #a << " = " << a << endl
#define dd(a) cout << #a << " = " << a << " "
#define all(a) a.begin(), a.end()
#define pw(x) (1ll<<(x))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef double db;

#define mem(a,x) memset(a,x,sizeof(a))
const int _p=998244353;

template <class V,int M>
struct Poly{
	V a[M];
	Poly() { mem(a,0); }
	Poly(const vi &t) {
		mem(a,0);
		for (int i=0; i+1<sz(t); 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;
		rep(i,0,M) c[i]=a[i]+b[i];
		return c;
	}
	inline friend Poly operator - (const Poly &a,const Poly &b) {
		Poly c;
		rep(i,0,M) c[i]=a[i]-b[i];
		return c;
	}
	inline friend Poly operator * (const Poly &a,const Poly &b) {
		Poly c;
		rep(i,0,M) for (int j=0; i+j<M; j++) c[i+j]+=a[i]*b[j];
		return c;
	}
	inline friend Poly operator / (Poly a,const Poly &b) {
		rep(i,0,M) rep(j,1,i+1) a[i]+=(ll)a[i-j]*(-b[j]+(!j))%_p,a[i]%=_p;
		return a;
	}
	inline friend Poly operator << (const Poly &a,int k) {
		Poly c;
		rep(i,0,M-k) c[i]=a[i+k];
		return c;
	}
	inline friend Poly operator >> (const Poly &a,int k) {
		Poly c;
		per(i,k,M) c[i]=a[i-k];
		return c;
	}
	inline friend Poly operator ^ (Poly a,ll 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");
		rep(i,0,M) printf("a[%d]=%d\n",i,a[i]);
		printf("\n\n\n");
	}
};

ll h(ll x) { return x*(x-1)%_p*(x-1)%_p; }

Poly<int,40> FM,FZ,F0,F1,F2,
	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});

const int N=50005,M=40;
int n,m,x,g[N]; ll ans=0,ret;

void file_put() {
    freopen("filename.in", "r", stdin);
    freopen("filename.out", "w", stdout);
}

int main() {
	//file_put();

	scanf("%d",&n);
	g[0]=g[2]=1;
	rep(i,4,N) g[i]=((ll)g[i-2]+g[i-4])%_p;
	FM=((P0>>1)-Q)*((P2>>3)-Q)-(sqr(P1)>>4);
	FZ=P1*Q;
	F0=((sqr(P1)*Q>>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;
	//de(ans);
	rep(i,2,n-1) {
		ret=(ll)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+=(ll)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;
}

#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define per(i, a, b) for(int i=(b)-1; i>=(a); i--)
#define sz(a) (int)a.size()
#define de(a) cout << #a << " = " << a << endl
#define dd(a) cout << #a << " = " << a << " "
#define all(a) a.begin(), a.end()
#define pw(x) (1ll<<(x))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef double db;

#define mem(a,x) memset(a,x,sizeof(a))
const int _p=998244353;

template <class V,int M>
struct Poly{
	V a[M];
	Poly() { mem(a,0); }
	Poly(const vi &t) {
		mem(a,0);
		for (int i=0; i+1<sz(t); ++i) 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;
		rep(i,0,M) c[i]=a[i]+b[i];
		return c;
	}
	inline friend Poly operator - (const Poly &a,const Poly &b) {
		Poly c;
		rep(i,0,M) c[i]=a[i]-b[i];
		return c;
	}
	inline friend Poly operator * (const Poly &a,const Poly &b) {
		Poly c;
		rep(i,0,M) for (int j=0; i+j<M; j++) c[i+j]+=a[i]*b[j];
		return c;
	}
	inline friend Poly operator / (Poly a,const Poly &b) {
		rep(i,0,M) rep(j,1,i+1) a[i]+=a[i-j]*(-b[j]+(!j));
		return a;
	}
	inline friend Poly operator << (const Poly &a,int k) {
		Poly c;
		rep(i,0,M-k) c[i]=a[i+k];
		return c;
	}
	inline friend Poly operator >> (const Poly &a,int k) {
		Poly c;
		per(i,k,M) c[i]=a[i-k];
		return c;
	}
	inline friend Poly operator ^ (Poly a,ll 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");
		rep(i,0,M) printf("a[%d]=%d\n",i,a[i]);
		printf("\n\n\n");
	}
};

ll h(ll x) { return x*(x-1)%_p*(x-1)%_p; }

Poly<int,40> FM,FZ,F0,F1,F2,
	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});

const int N=50005,M=40;
int n,m,x,g[N]; ll ans=0,ret;

void file_put() {
    freopen("filename.in", "r", stdin);
    freopen("filename.out", "w", stdout);
}

int main() {
	file_put();

	scanf("%d",&n);
	g[0]=g[2]=1;
	rep(i,4,N) g[i]=((ll)g[i-2]+g[i-4])%_p;
	FM=((P0>>1)-Q)*((P2>>3)-Q)-(sqr(P1)>>4);
	FZ=P1*Q;
	F0=((sqr(P1)*Q>>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;
	//de(ans);
	rep(i,2,n-1) {
		ret=(ll)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+=(ll)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;
}

#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define per(i, a, b) for(int i=(b)-1; i>=(a); i--)
#define sz(a) (int)a.size()
#define de(a) cout << #a << " = " << a << endl
#define dd(a) cout << #a << " = " << a << " "
#define all(a) a.begin(), a.end()
#define pw(x) (1ll<<(x))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef double db;

#define mem(a,x) memset(a,x,sizeof(a))
const int _p=998244353;

template <class V,int M>
struct Poly{
	V a[M];
	Poly() { mem(a,0); }
	Poly(const vi &t) {
		mem(a,0);
		for (int i=0; i+1<sz(t); ++i) 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;
		rep(i,0,M) c[i]=a[i]+b[i];
		return c;
	}
	inline friend Poly operator - (const Poly &a,const Poly &b) {
		Poly c;
		rep(i,0,M) c[i]=a[i]-b[i];
		return c;
	}
	inline friend Poly operator * (const Poly &a,const Poly &b) {
		Poly c;
		rep(i,0,M) for (int j=0; i+j<M; j++) c[i+j]+=a[i]*b[j];
		return c;
	}
	inline friend Poly operator / (Poly a,const Poly &b) {
		rep(i,0,M) rep(j,1,i+1) a[i]+=(ll)a[i-j]*(-b[j]+(!j))%_p,a[i]%=_p;
		return a;
	}
	inline friend Poly operator << (const Poly &a,int k) {
		Poly c;
		rep(i,0,M-k) c[i]=a[i+k];
		return c;
	}
	inline friend Poly operator >> (const Poly &a,int k) {
		Poly c;
		per(i,k,M) c[i]=a[i-k];
		return c;
	}
	inline friend Poly operator ^ (Poly a,ll 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");
		rep(i,0,M) printf("a[%d]=%d\n",i,a[i]);
		printf("\n\n\n");
	}
};

ll h(ll x) { return x*(x-1)%_p*(x-1)%_p; }

Poly<int,40> FM,FZ,F0,F1,F2,
	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});

const int N=50005,M=40;
int n,m,x,g[N]; ll ans=0,ret;

void file_put() {
    freopen("filename.in", "r", stdin);
    freopen("filename.out", "w", stdout);
}

int main() {
	//file_put();

	scanf("%d",&n);
	g[0]=g[2]=1;
	rep(i,4,N) g[i]=((ll)g[i-2]+g[i-4])%_p;
	FM=((P0>>1)-Q)*((P2>>3)-Q)-(sqr(P1)>>4);
	FZ=P1*Q;
	F0=((sqr(P1)*Q>>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;
	//de(ans);
	rep(i,2,n-1) {
		ret=(ll)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+=(ll)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;
}

#include<cstdio>
#include<algorithm>
#include<cctype>
#include<cstring>
#include<map>
#include<bitset>
#include<stack>
#include<queue>
#include<set>
#include<cmath>
#include<vector>

using namespace std;

#define bomb exit(1)
#define INF 1000000000
#define LINF 1000000000000000000ll
#define pprint(x) print(x),putchar(' ')
#define fprint(x) print(x),putchar('\n')
#define EE(x); struct edge { int nxt,to,w; }e[M << 1]; int head[N],cnt = x ^ 1;\
	void add(int u,int v,int w = 0) { e[++cnt].w = w,e[cnt].to = v,e[cnt].nxt = head[u];head[u] = cnt; }\
	void add_edge(int u,int v,int w = 0) { add(u,v,w),add(v,u,w * x); }
#define Mod(x) ((x) >= mod ? x - mod : x)
#define eps 0.00000001
#define sqr(x) ((x) * (x))
#define iter iterator
#define fi first
#define se second
#define ll long long
//#define getchar() (SS == TT && (TT = (SS = BB) + fread(BB,1,1 << 15,stdin),TT == SS) ? EOF : *SS++)
//char BB[1 << 15],*SS = BB,*TT = BB;
inline ll read()
{
	ll x = 0;int f = 1;char ch = getchar();
	for(;!isdigit(ch);ch = getchar()) if(ch == '-') f = -1;
	for(;isdigit(ch);ch = getchar()) x = x * 10 + (ch ^ 48);
	return x * f;
}
void print(ll x)
{
	if(x < 0) putchar('-'),x = -x;
	if(x > 9) print(x / 10);
	putchar(x % 10 + '0');
}

const int N = 50010,mod = 998244353;
int n;
ll f[N] = {0,0,0,0,24,4,240,204,1316,2988,6720,26200,50248,174280,436904,1140888,3436404},r[17] = {0,0,4,8,-1,16,-10,4,-12,-48,26,-44,15,-16,-4,-4,-1};

int main()
{
    n = read() + 1;
    for(int i = 17;i <= n;i++)
	{
        int x = 0;
        for (int j = 1;j <= 16;j++)
            f[i] = Mod(f[i] + f[i - j] * r[j] % mod);
    }
    fprint(f[n]);
    return 0;
}

#include<bits/stdc++.h>
#pragma GCC optimize("Ofast,unroll-loops")
using namespace std;
typedef int ll;
typedef long long int li;
const ll MAXN=2e5+51,MOD=998244353;
ll n;
ll g[100]={
	0,4,8,-1,16,-10,4,-12,-48,26,-44,15,-16,-4,-4,-1
};
ll f[MAXN]={
	0,0,0,24,4,240,204,1316,2988,
	6720,26200,50248,174280,436904,1140888,3436404
};
inline ll read()
{
    register ll num=0,neg=1;
    register char ch=getchar();
    while(!isdigit(ch))
    {
        ch=getchar();
    }
    if(ch=='-')
    {
        neg=-1;
        ch=getchar();
    }
    while(isdigit(ch))
    {
        num=(num<<3)+(num<<1)+(ch-'0');
        ch=getchar();
    }
    return num*neg;
}
int main()
{
	n=read();
	if(n<=15)
	{
		return printf("%d\n",f[n]),0;
	}
	for(register int i=16;i<=n;i++)
	{
		for(register int j=0;j<16;j++)
		{
			f[i]=(f[i]+(li)g[j]*f[i-j-1]%MOD)%MOD;
		}
	}
	printf("%d\n",f[n]);
}

#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 2e5 + 5;
const int mod = 998244353;
const int G = 3;
inline int Pow(ll a, int x) {
	ll res = 1;
	while (x) {
		if (x & 1) res = res * a % mod;
		a = a * a % mod;
		x >>= 1;
	}
	return res;
}
void NTT(int *a, int n, int rev) {
	for (int i = 0, j = 0; i < n; ++i) {
		if (i > j) swap(a[i], a[j]);
		for (int k = n >> 1; (j ^= k) < k; k >>= 1);
	}
	for (int i = 2; i <= n; i <<= 1) {
		int m = i >> 1;
		int w = Pow(G, (mod - 1) / i);
		if (rev == -1) w = Pow(w, mod - 2);
		for (int j = 0; j < n; j += i) {
			ll Wx = 1;
			for (int k = 0; k != m; k++) {
				ll z = a[j + m + k] * Wx % mod;
				a[j + m + k] = a[j + k] - z + mod;
				if (a[j + m + k] >= mod) a[j + m + k] -= mod;
				a[j + k] = a[j + k] + z;
				if (a[j + k] >= mod) a[j + k] -= mod;
				Wx = Wx * w % mod;
			}
		}
	}
	if (rev == -1) {
		ll inv = Pow(n, mod - 2);
		for (int i = 0; i < n; i++) a[i] = a[i] * inv % mod;
	}
}
int n, len, g[N], f0[N], f1[N], f2[N];
int F1[N], F2[N], F0[N], G1[N], G2[N], G3[N], a[N];
ll ans, sqr[N];
void solve(int l, int r) {
	if (l == r) return;
	int mid = l + r >> 1;
	solve(l, mid);
	len = 1;
	while (len < r - l + 1) len <<= 1;
	for (int i = 0; i < len; i++) {
		F0[i] = F1[i] = F2[i] = 0;
		G1[i] = G2[i] = G3[i] = 0;
	}
	for (int i = l; i <= mid; i++) {
		F0[i - l] = f0[i];
		F1[i - l] = f1[i];
		F2[i - l] = f2[i];
	}
	for (int i = 2; i <= r - l; i++) {
		G1[i] = (ll)g[i - 1] * sqr[i - 1] % mod;
		G2[i] = (ll)g[i - 2] * sqr[i - 1] % mod;
		if (i > 2) G3[i] = (ll)g[i - 3] * sqr[i - 1] % mod;
	}
	NTT(F0, len, 1); NTT(F1, len, 1); NTT(F2, len, 1);
	NTT(G1, len, 1); NTT(G2, len, 1); NTT(G3, len, 1);
	//0
	for (int i = 0; i < len; i++) a[i] = (ll)F0[i] * G1[i] % mod;
	NTT(a, len, -1);
	for (int i = mid + 1; i <= r; i++) (f0[i] += a[i - l]) %= mod;
	for (int i = 0; i < len; i++) a[i] = (ll)F1[i] * G2[i] % mod;
	NTT(a, len, -1);
	for (int i = mid + 1; i <= r; i++) (f0[i] += a[i - l]) %= mod;
	//1
	for (int i = 0; i < len; i++) a[i] = (ll)F1[i] * G1[i] % mod;
	NTT(a, len, -1);
	for (int i = mid + 1; i <= r; i++) (f1[i] += a[i - l]) %= mod;
	for (int i = 0; i < len; i++) a[i] = (ll)F2[i] * G2[i] % mod;
	NTT(a, len, -1);
	for (int i = mid + 1; i <= r; i++) (f1[i] += a[i - l]) %= mod;
	//2
	for (int i = 0; i < len; i++) a[i] = (ll)F1[i] * G2[i] % mod;
	NTT(a, len, -1);
	for (int i = mid + 1; i <= r; i++) (f2[i] += a[i - l]) %= mod;
	for (int i = 0; i < len; i++) a[i] = (ll)F2[i] * G3[i] % mod;
	NTT(a, len, -1);
	for (int i = mid + 1; i <= r; i++) (f2[i] += a[i - l]) %= mod;
	solve(mid + 1, r);
}
int main() {
	for (int i = 1; i < N; i++) sqr[i] = (ll)i * i % mod;
	cin >> n;
	g[0] = 1;
	for (int i = 1; i <= n; i++) {
		if (i - 2 >= 0) (g[i] += g[i - 2]) %= mod;
		if (i - 4 >= 0) (g[i] += g[i - 4]) %= mod;
	}
	f0[0] = f2[0] = 1;
	solve(0, n);
	// n^2
	/*
	for (int i = 1; i <= n; i++) {
		for (int j = 2; j <= i; j++) {
			(f0[i] += (ll)f0[i - j] * g[j - 1] % mod * sqr[j - 1] % mod) %= mod;
			if (j >= 2) (f0[i] += (ll)f1[i - j] * g[j - 2] % mod * sqr[j - 1] % mod) %= mod;
			(f1[i] += (ll)f1[i - j] * g[j - 1] % mod * sqr[j - 1] % mod) %= mod;
			if (j >= 2) (f1[i] += (ll)f2[i - j] * g[j - 2] % mod * sqr[j - 1] % mod) %= mod;
			if (j >= 2) (f2[i] += (ll)f1[i - j] * g[j - 2] % mod * sqr[j - 1] % mod) %= mod;
			if (j >= 3) (f2[i] += (ll)f2[i - j] * g[j - 3] % mod * sqr[j - 1] % mod) %= mod;
		}
	}
	*/
	ans = (ll)(g[n - 1] + g[n - 3]) * n % mod * sqr[n - 1] % mod;
	for (int i = 1; i < n - 2	; i++) {
		ll tmp = 0;
		(tmp += g[i] * f0[n - i - 1] % mod * sqr[i] % mod) %= mod;
		(tmp += g[i - 1] * f1[n - i - 1] % mod * sqr[i] % mod) %= mod;
		if (i >= 2) (tmp += g[i - 2] * f2[n - i - 1] % mod * sqr[i] % mod) %= mod;
		(tmp += g[i - 1] * f1[n - i - 1] % mod * sqr[i] % mod) %= mod;
		tmp = tmp * (i + 1) % mod;
		(ans += tmp) %= mod;
	}
	cout << ans;
}

#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define IT iterator
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
#define debug puts("wzpakking")
#define y1 ysghysgsygsh
using namespace std;
const int mo=998244353;
const int FFTN=1<<16;
const int N=FFTN+5;
int w[N],W[N],R[N];
int A[N],B[N],C[N];
int D[N],E[N],F[N];
ull p[N];
int power(int x,int y){
	int s=1;
	for (;y;y/=2,x=1ll*x*x%mo)
		if (y&1) s=1ll*s*x%mo;
	return s;
}
void FFTinit(){
	W[0]=1;
	W[1]=power(3,(mo-1)/FFTN);
	For(i,2,N-1) W[i]=1ll*W[i-1]*W[1]%mo;
}
int FFTinit(int n){
	int L=1;
	for (;L<=n;L<<=1);
	For(i,0,L-1) R[i]=(R[i>>1]>>1)|((i&1)?(L>>1):0);
	return L;
}
void DFT(int *a,int n){
	For(i,0,n-1) p[R[i]]=a[i];
	for (int d=1;d<n;d<<=1){
		int len=FFTN/(d<<1);
		for (int i=0,j=0;i<d;i++,j+=len) w[i]=W[j];
		for (int i=0;i<n;i+=(d<<1))
			for (int j=0;j<d;j++){
				int y=p[i+j+d]*w[j]%mo;
				p[i+j+d]=p[i+j]+mo-y;
				p[i+j]+=y;
			}
	}
	For(i,0,n-1) a[i]=p[i]%mo;
}
void IDFT(int *a,int n){
	For(i,0,n-1) p[R[i]]=a[i];
	for (int d=1;d<n;d<<=1){
		int len=FFTN/(d<<1);
		for (int i=0,j=FFTN;i<d;i++,j-=len) w[i]=W[j];
		for (int i=0;i<n;i+=(d<<1))
			for (int j=0;j<d;j++){
				int y=p[i+j+d]*w[j]%mo;
				p[i+j+d]=p[i+j]+mo-y;
				p[i+j]+=y;
			}
	}
	int val=power(n,mo-2);
	For(i,0,n-1) a[i]=p[i]*val%mo;
}

int n,g[N];
int g0[N],g1[N],g2[N];
int f0[N],f1[N],f2[N];

void divide(int l,int r){
	if (l==r){
		f0[l]=(f0[l]+g0[l])%mo;
		f1[l]=(f1[l]+g1[l])%mo;
		f2[l]=(f2[l]+g2[l])%mo;
		//cout<<f0[l]<<' '<<f1[l]<<' '<<f2[l]<<endl;
		return;
	}
	int mid=(l+r)/2;
	divide(l,mid);
	int L=FFTinit(r-l+1);
	For(i,0,L-1) A[i]=B[i]=C[i]=D[i]=E[i]=F[i]=0;
	For(i,l,mid) A[i-l]=f0[i],B[i-l]=f1[i],C[i-l]=f2[i];
	For(i,0,r-l) D[i]=g0[i],E[i]=g1[i],F[i]=g2[i];
	DFT(A,L); DFT(B,L); DFT(C,L);
	DFT(D,L); DFT(E,L); DFT(F,L);
	For(i,0,L-1){
		C[i]=1ll*C[i]*F[i]%mo;
		F[i]=1ll*F[i]*B[i]%mo;
		B[i]=1ll*B[i]*E[i]%mo;
		E[i]=1ll*E[i]*A[i]%mo;
		A[i]=1ll*A[i]*D[i]%mo;
	}
	IDFT(A,L); IDFT(B,L); IDFT(C,L);
	IDFT(D,L); IDFT(E,L); IDFT(F,L);
	For(i,mid+1,r){
		f0[i]=(1ll*f0[i]+A[i-l-1]+(i>=l-3?B[i-l-3]:0))%mo;
		f1[i]=(1ll*f1[i]+E[i-l-1]+(i>=l-3?F[i-l-3]:0))%mo;
		f2[i]=(1ll*f2[i]+B[i-l-1]+(i>=l-3?C[i-l-3]:0))%mo;
	}
	divide(mid+1,r);
}
int main(){
	FFTinit();
	scanf("%d",&n);
	g[0]=1; g[2]=1;
	for (int i=4;i<=n;i+=2)
		g[i]=(g[i-2]+g[i-4])%mo;
	For(i,0,n){
		g0[i]=1ll*g[i]*i*i%mo;
		g1[i]=1ll*g[i]*(i+1)*(i+1)%mo;
		g2[i]=1ll*g[i]*(i+2)*(i+2)%mo;
	}
	//cout<<g[6]<<endl;
	/*for (int i=0;i<=n;i++){
		f0[i]=g0[i]; f1[i]=g1[i]; f2[i]=g2[i];
		for (int j=0;j<=i-1;j++){
			f0[i]=(f0[i]+1ll*f0[j]*g0[i-j-1])%mo;
			f1[i]=(f1[i]+1ll*f0[j]*g1[i-j-1])%mo;
			f2[i]=(f2[i]+1ll*f1[j]*g1[i-j-1])%mo;
		}
		for (int j=0;j<=i-3;j++){
			f0[i]=(f0[i]+1ll*f1[j]*g1[i-j-3])%mo;
			f1[i]=(f1[i]+1ll*f1[j]*g2[i-j-3])%mo;
			f2[i]=(f2[i]+1ll*f2[j]*g2[i-j-3])%mo;
		}
	}*/
	divide(0,n);
	int ans=0;
	ans=(ans+1ll*n*g0[n-1])%mo;
	//cerr<<ans<<endl;
	ans=(ans+1ll*n*g2[n-3])%mo;
	//cerr<<ans<<endl;
	For(i,0,n-2) ans=(ans+1ll*g0[i]*f0[n-i-2]%mo*(i+1))%mo;
	For(i,0,n-4) ans=(ans+2ll*g1[i]*f1[n-i-4]%mo*(i+2))%mo;
	For(i,0,n-6) ans=(ans+1ll*g2[i]*f2[n-i-6]%mo*(i+3))%mo;
	printf("%d\n",ans);
}

#include<set>
#include<map>
#include<deque>
#include<queue>
#include<stack>
#include<cmath>
#include<ctime>
#include<bitset>
#include<string>
#include<vector>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<complex>
#include<iostream>
#include<algorithm>
#define ll long long
using namespace std;

const int maxn = 210000;
const ll Mod = 998244353;
const ll g = 3;

ll pw(ll x,int k)
{
    ll re=1ll;
    for(;k;k>>=1,(x*=x)%=Mod)
        if(k&1) (re*=x)%=Mod;
    return re;
}

int N,ln;
ll ni,w[maxn];
int id[maxn];

void DFT(ll f[],const int n,const int sig)
{
	for(int i=0;i<n;i++) if(i<id[i]) swap(f[i],f[id[i]]);

	int kk=N/n;
	for(int m=2;m<=n;m<<=1)
	{
		int t=m>>1,tt=n/m;
		for(int j=0;j<n;j+=m)
		{
			for(int i=0;i<t;i++)
			{
				ll wn=sig==1?w[i*tt*kk]:w[(n-i*tt)*kk];

				ll tx=f[j+i],ty=f[j+i+t]*wn%Mod;
				f[j+i]=(tx+ty)%Mod;
				f[j+i+t]=(tx-ty+Mod)%Mod;
			}
		}
	}
	if(sig==-1)
	{
		ni=pw(n,Mod-2);
		for(int i=0;i<n;i++) (f[i]*=ni)%=Mod;
	}
}
void prepare(const int n,const int ln)
{
	for(int i=1;i<n;i++) id[i]=(id[i>>1]>>1)|((i&1)<<ln-1);
}
ll t1[maxn],t2[maxn];/*
void get_inv(ll f[],ll H[],const int n,const int ln)
{
	if(n==1) { H[0]=pw(f[0],Mod-2); return; }
	get_inv(f,H,n>>1,ln-1);

	prepare(n<<1,ln+1);
	for(int i=0;i<n;i++) t1[i]=f[i],t1[i+n]=0,H[i+n]=0;
	DFT(t1,n<<1,1); DFT(H,n<<1,1);
	for(int i=0;i<(n<<1);i++) t1[i]=H[i]*(2ll-t1[i]*H[i]%Mod)%Mod;
	DFT(t1,n<<1,-1);
	for(int i=0;i<n;i++) H[i]=t1[i],H[i+n]=0;
}*/
void get_inv(ll a[],ll b[],const int n,const int ln)
{
    b[0]=pw(a[0],Mod-2);
    for(int m=2,ml=1;m<=n;m<<=1,ml++)
    {
        prepare(m<<1,ml+1);
        for(int i=0;i<m;i++) t1[i]=a[i],t1[i+m]=0,b[i+m]=0;
        DFT(t1,m<<1,1); DFT(b,m<<1,1);
        for(int i=0;i<(m<<1);i++) t1[i]=b[i]*(2ll-t1[i]*b[i]%Mod)%Mod;
        DFT(t1,m<<1,-1);
        for(int i=0;i<m;i++) b[i]=t1[i],b[i+m]=0ll;
    }
}
int n;
ll A[maxn],B[maxn],C[maxn],D[maxn];
ll f0[maxn],f1[maxn],FZ[maxn],FM[maxn];
ll G[maxn],G0[maxn],G1[maxn],G2[maxn];
ll F0[maxn],F1[maxn],F2[maxn];

ll sqr(const int i){return (ll)i*i%Mod;}

int main()
{
	scanf("%d",&n);
	N=1,ln=0; while(N<=2*n) N<<=1,ln++;
	w[0]=1ll; w[1]=pw(g,(Mod-1)/N); for(int i=2;i<=N;i++) w[i]=(w[i-1]*w[1])%Mod;

	G[0]=1ll,G[2]=1ll;
	for(int i=4;i<=n;i+=2) G[i]=(G[i-2]+G[i-4])%Mod;
	for(int i=0;i<=n;i++)
	{
		G0[i]=G[i]*sqr(i)%Mod;
		G1[i]=G[i]*sqr(i+1)%Mod;
		G2[i]=G[i]*sqr(i+2)%Mod;
	}
	for(int i=0;i<=n;i++)
	{
		if(i+1<=n) A[i+1]=G0[i],B[i+1]=G1[i];
		if(i+3<=n) C[i+3]=G1[i],D[i+3]=G2[i];
	}

	for(int i=0;i<N;i++) f0[i]=A[i],f1[i]=D[i];
	f0[0]=f1[0]=Mod-1;
	prepare(N,ln); DFT(f0,N,1); DFT(f1,N,1);
	for(int i=0;i<N;i++) FM[i]=f0[i]*f1[i]%Mod;
	DFT(FM,N,-1);
	for(int i=0;i<N;i++) f0[i]=B[i],f1[i]=C[i];
	DFT(f0,N,1); DFT(f1,N,1);
	for(int i=0;i<N;i++) f0[i]=f0[i]*f1[i]%Mod;
	DFT(f0,N,-1);
	for(int i=0;i<=n;i++) FM[i]=(FM[i]-f0[i]+Mod)%Mod;
	for(int i=n+1;i<N;i++) FM[i]=0;

	for(int i=0;i<N;i++) f0[i]=0;
	get_inv(FM,f0,N>>1,ln-1); for(int i=0;i<N;i++) FM[i]=(f0[i]+Mod)%Mod;
	prepare(N,ln); DFT(FM,N,1);

	for(int i=0;i<N;i++) f0[i]=C[i],f1[i]=G1[i];
	DFT(f0,N,1); DFT(f1,N,1);
	for(int i=0;i<N;i++) FZ[i]=f0[i]*f1[i]%Mod;
	DFT(FZ,N,-1); for(int i=n+1;i<N;i++) FZ[i]=0;
	for(int i=0;i<N;i++) f0[i]=G0[i],f1[i]=D[i]; f1[0]=Mod-1;
	DFT(f0,N,1); DFT(f1,N,1);
	for(int i=0;i<N;i++) f0[i]=f0[i]*f1[i]%Mod;
	DFT(f0,N,-1); for(int i=n+1;i<N;i++) f0[i]=0;
	for(int i=0;i<N;i++) FZ[i]=(FZ[i]-f0[i]+Mod)%Mod;
	DFT(FZ,N,1);
	for(int i=0;i<N;i++) F0[i]=FZ[i]*FM[i]%Mod;
	DFT(F0,N,-1); for(int i=n+1;i<N;i++) F0[i]=0;

	for(int i=0;i<N;i++) FZ[i]=G1[i];
	DFT(FZ,N,1);
	for(int i=0;i<N;i++) F1[i]=FZ[i]*FM[i]%Mod;
	DFT(F1,N,-1); for(int i=n+1;i<N;i++) F1[i]=0;

	for(int i=0;i<N;i++) FM[i]=(Mod-D[i])%Mod; FM[0]++;
	for(int i=0;i<N;i++) f0[i]=0;
	get_inv(FM,f0,N>>1,ln-1); for(int i=0;i<N;i++) FM[i]=(f0[i]+Mod)%Mod;
	prepare(N,ln); DFT(FM,N,1);

	for(int i=0;i<N;i++) f0[i]=B[i],f1[i]=F1[i];
	DFT(f0,N,1); DFT(f1,N,1);
	for(int i=0;i<N;i++) f0[i]=f0[i]*f1[i]%Mod;
	DFT(f0,N,-1); for(int i=n+1;i<N;i++) f0[i]=0;
	for(int i=0;i<N;i++) FZ[i]=(G2[i]+f0[i])%Mod;
	DFT(FZ,N,1);
	for(int i=0;i<N;i++) F2[i]=FZ[i]*FM[i]%Mod;
	DFT(F2,N,-1); for(int i=n+1;i<N;i++) F2[i]=0;

	ll ans=(G[n-1]*sqr(n-1)%Mod+G[n-3]*sqr(n-1)%Mod)%Mod*(ll)n%Mod;
	for(int i=1;i<n-2;i++)
	{
		(ans+=G[i]*sqr(i)*F0[n-i-2]%Mod*(ll)(i+1)%Mod)%=Mod;
		(ans+=G[i-1]*sqr(i)%Mod*F1[n-i-3]%Mod*(ll)(i+1)%Mod*2ll%Mod)%=Mod;
		if(i>=2&&n-i-4>=0) (ans+=G[i-2]*sqr(i)%Mod*F2[n-i-4]%Mod*(ll)(i+1)%Mod)%=Mod;
	}
	printf("%I64d\n",ans);

	return 0;
}

// They can't break me, as long as I know who I am...

#include<bits/stdc++.h>

#define F first
#define S second
#define PB push_back
#define sz(s) int((s).size())
#define bit(n,k) (((n)>>(k))&1)

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int mod = (119<<23) + 1, Lg = 17, maxn = (1<<Lg) + 10;

int dp[maxn][2][2], f[maxn], sm[maxn];

void mkay(int &a, int b){
    a = (a + b) %mod;
}
/*
void go(int &a, int n, function<int(int)> f1, function<int(int)> f2){
    for(int i = 0; i < n; i++)
	mkay(a, 1ll * f1(i) * f2(n-1-i) %mod );
}
*/
int arr[Lg][2][2][2][2 * maxn];
int A[2 * maxn], B[2 * maxn];//, frs[2][2 * maxn], sec[2][2][2 * maxn];
int w[2][2 * maxn];

int Pow(int a, int b){
    int ans = 1;
    for(; b; b>>=1, a = 1ll * a * a %mod)
	if(b&1)
	    ans = 1ll * ans * a %mod;
    return ans;
}

void fft(int *arr, int lg, bool rv){
    w[0][0] = 1;
    w[0][1] = Pow(3, 119<<(23 - lg));
    int n = 1<<lg;
    for(int i = 2; i < n; i++)
	w[0][i] = 1ll * w[0][i-1] * w[0][1] %mod;
    w[1][0] = 1;
    for(int i = 1; i < n; i++)
	w[1][i] = w[0][n-i];
    for(int i = 0; i < n; i++){
	int x = 0;
	for(int j = 0; j < lg; j++)
	    x+= bit(i,j) << (lg-1-j);
	if(x < i)
	    swap(arr[x], arr[i]);
    }
    for(int stp = 0; stp < lg; stp++){
	int stpl = 1<<stp;
	for(int l = 0; l < n; l+= stpl*2){
	    for(int i = 0; i < stpl; i++){
		int &A = arr[l + i], &B = arr[l + i + stpl], C = 1ll * w[rv][i << (lg-1-stp)] * B %mod;
		B = (A - C) %mod;
		A = (A + C) %mod;
	    }
	}
    }
    if(rv){
	int r = Pow( 1<<lg, mod-2 );
	for(int i = 0; i < n; i++)
	    arr[i] = 1ll * arr[i] * r %mod;
    }
}

void calc(int l = 0, int r = 1<<(Lg-1)){// (]
    if(r-l == 1){
	int SZ = 0;
	for(int i = 0; i < Lg; i++){
	    if(bit(r-1, i)){
		SZ += 1<<i;
		for(int m1 : {0,1})
		    for(int m2 : {0,1})
			mkay( dp[r][m1][m2], arr[i][m1][m2][r & 1][SZ-1] );
	    }
	}
    }
    else{
	int mid = (l+r) >> 1;
	calc(l, mid), calc(mid, r);
    }
    int id = __builtin_ctz(r-l);
    /*
      for(int x = 0; x < (1<<(id+1)); x++){
      frs[0][x] = x == 0 ? 0 : 1ll * x * x %mod * f[(x/2)] %mod;
      frs[1][x] = x == 0 ? 0 : 1ll * x * x %mod * f[(x/2)-1] %mod;
      for(int m2 : {0,1}){
      sec[0][m2][x] = x >= (1<<id) ? 0 : dp[x + l + 1][(0 ^ x) &1][m2];
      sec[1][m2][x] = x >= (1<<id) ? 0 : dp[x + l + 1][(1 ^ x) &1][m2];
      }
      }

      fft(frs[0], id+1, 0);
      fft(frs[1], id+1, 0);
      fft(sec[0][0], id+1, 0);
      fft(sec[1][0], id+1, 0);
      fft(sec[0][1], id+1, 0);
      fft(sec[1][1], id+1, 0);
    */
    for(int m1 : {0,1})
	for(int m2 : {0,1})
	    for(int no : {0,1}){
		for(int x = 0; x < (1<<(id+1)); x++){
		    A[x] = x == 0 ? 0 : 1ll * x * x %mod *  f[(x/2) - (m1 && !(x &1))];
		    B[x] = x >= (1<<id) ? 0 : dp[x + l + 1][(m1 ^ no ^ 1 ^ (x + l +1)) &1][m2];
		}
		fft(A, id+1, 0);
		fft(B, id+1, 0);
		//		for(int x = 0; x < (1<<(id+1)); x++)
		//	    arr[id][m1][m2][no][x] = 1ll * frs[m1 && !(x & 1)][x] * sec[(m1 ^ no ^ 1) &1][m2][x] %mod;
		for(int x = 0; x < (1<<(id+1)); x++)
		    arr[id][m1][m2][no][x] = 1ll * A[x] * B[x] %mod;
		fft(arr[id][m1][m2][no], id+1, 1);
	    }

}

int main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie();

    int n;
    cin >> n;

    f[0] = f[1] = 1;
    for(int i = 2; i <= n; i++)
	f[i] = (f[i-1] + f[i-2]) %mod;

    dp[1][0][1] = dp[1][1][0] = 1;
    /*
    for(int i = 2; i <= n; i++){
	if(i & 1)
	    dp[i][0][1] = dp[i][1][0] = 1ll * i * i %mod * f[i/2] %mod;
	else
	    dp[i][0][0] = 1ll * i * i %mod * f[i/2] %mod, dp[i][1][1] = 1ll * i * i %mod * f[(i/2)-1] %mod;
	for(int m1 : {0,1})
	    for(int m2 : {0,1})
		go( dp[i][m1][m2], i, [&](int x){ return x == 0 ? 0 : 1ll * x * x %mod *  f[(x/2) - (m1 && !(x &1))]; }, [&](int x){ return dp[x][m1 ^ ( (i-x-1) &1 )][m2]; } ), cout<<i<<" "<<m1<<" "<<m2<<" "<<dp[i][m1][m2]<<endl;
		}*/

    for(int i = 1; i <= (1<<Lg); i++){
	if(i & 1)
	    dp[i][0][1] = dp[i][1][0] = 1ll * i * i %mod * f[i/2] %mod;
	else
	    dp[i][0][0] = 1ll * i * i %mod * f[i/2] %mod, dp[i][1][1] = 1ll * i * i %mod * f[(i/2)-1] %mod;
    }
    calc();

    for(int j = 1; j < n-1; j++){
	if(j&1)
	    mkay( sm[j], 1ll * j * j %mod * f[j/2] %mod * dp[n-1-j-1][1][0] %mod ), mkay( sm[j], 1ll * j * j %mod * f[j/2] %mod * dp[n-1-j-1][0][1] %mod );
	else
	    mkay( sm[j], 1ll * j * j %mod * f[j/2] %mod * dp[n-1-j-1][0][0] %mod ), mkay( sm[j], 1ll * j * j %mod * f[(j/2)-1] %mod * dp[n-1-j-1][1][1] %mod );
    }
    for(int j = n-2; j >= 0; j--){
	mkay( sm[j], sm[j+1] );
    }
    int ans = 0;
    for(int i = 0; i < n; i++)
	mkay(ans, sm[i]);
    if(n&1)
	mkay(ans, 1ll * n * (n-1) %mod * (n-1) %mod * (f[n/2] + f[(n/2)-1]) %mod);
    if(ans < 0)
	ans+= mod;
    return cout << ans << endl,0;
}
// #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
#define clr(x) memset(x,0,sizeof (x))
#define For(i,a,b) for (int i=(a);i<=(b);i++)
#define Fod(i,b,a) for (int i=(b);i>=(a);i--)
#define fi first
#define se second
#define pb(x) push_back(x)
//#define pb push_back
#define mp(x,y) make_pair(x,y)
#define outval(x) cerr<<#x" = "<<x<<endl
#define outv(x) cerr<<#x" = "<<x<<"  "
#define outtag(x) cerr<<"--------------"#x"---------------"<<endl
#define outarr(a,L,R) cerr<<#a"["<<L<<".."<<R<<"] = ";\
	For(_x,L,R) cerr<<a[_x]<<" ";cerr<<endl;
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned uint;
typedef long double LD;
typedef vector <int> vi;
typedef pair <int,int> pii;
LL read(){
	LL x=0,f=0;
	char ch=getchar();
	while (!isdigit(ch))
		f=ch=='-',ch=getchar();
	while (isdigit(ch))
		x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return f?-x:x;
}
const int N=1<<19,mod=998244353;
int Pow(int x,int y){
	int ans=1;
	for (;y;y>>=1,x=(LL)x*x%mod)
		if (y&1)
			ans=(LL)ans*x%mod;
	return ans;
}
void Add(int &x,int y){
	if ((x+=y)>=mod)
		x-=mod;
}
void Del(int &x,int y){
	if ((x-=y)<0)
		x+=mod;
}
int Add(int x){
	return x>=mod?x-mod:x;
}
int Del(int x){
	return x<0?x+mod:x;
}
namespace fft{
	int w[N],R[N];
	void init(int n){
		int d=0;
		while (1<<d<n)
			d++;
		For(i,0,n-1)
			R[i]=(R[i>>1]>>1)|((i&1)<<(d-1));
		w[0]=1,w[1]=Pow(3,(mod-1)/n);
		For(i,2,n-1)
			w[i]=(LL)w[i-1]*w[1]%mod;
	}
	void FFT(int *a,int n,int flag){
		For(i,0,n-1)
			if (i<R[i])
				swap(a[i],a[R[i]]);
		for (int t=n>>1,d=1;d<n;d<<=1,t>>=1)
			for (int i=0;i<n;i+=d<<1)
				for (int j=0;j<d;j++){
					int tmp=(LL)w[t*j]*a[i+j+d]%mod;
					a[i+j+d]=Del(a[i+j]-tmp);
					Add(a[i+j],tmp);
				}
		if (flag<0){
			reverse(a+1,a+n);
			int inv=Pow(n,mod-2);
			For(i,0,n-1)
				a[i]=(LL)a[i]*inv%mod;
		}
	}
	vi Mul(vi a,vi b){
		int n=1,m=max(0,(int)a.size()+(int)b.size()-1);
		while (n<m)
			n<<=1;
		a.resize(n),b.resize(n);
		init(n);
		FFT(&a[0],n,1),FFT(&b[0],n,1);
		For(i,0,n-1)
			a[i]=(LL)a[i]*b[i]%mod;
		FFT(&a[0],n,-1);
		a.resize(m);
		return a;
	}
}
vi operator + (vi a,vi b){
	int n=max(a.size(),b.size());
	a.resize(n),b.resize(n);
	For(i,0,n-1)
		Add(a[i],b[i]);
	return a;
}
vi operator * (vi a,vi b){
	return fft::Mul(a,b);
}
int n;
int a[N];
int sqr(int x){
	return (LL)x*x%mod;
}
void R(vi &a){
	a.resize(n+1);
}
int main(){
	n=read();
	a[0]=1,a[2]=1;
	For(i,4,n)
		a[i]=Add(a[i-2]+a[i-4]);
	int ans=0;
	Add(ans,(LL)(a[n-1]+a[n-3])*sqr(n-1)%mod*n%mod);
	vi f(n+10),g(n+10),h(n+10);
	For(i,0,n){
		f[i+1]=(LL)a[i]*sqr(i+0)%mod;
		g[i+2]=(LL)a[i]*sqr(i+1)%mod;
		h[i+3]=(LL)a[i]*sqr(i+2)%mod;
	}
	R(f),R(g),R(h);
	vi sf=f,sg=g,sh=h,F=f,G=g,H=h;
	For(_,1,16){
		vi sf2=sf+sg*g+sf*f;
		vi sg2=sg+sg*h+sf*g;
		vi sh2=sh+sg*g+sh*h;
		vi f2=f*f+g*g;
		vi g2=f*g+h*g;
		vi h2=h*h+g*g;
		swap(sf,sf2),swap(sg,sg2),swap(sh,sh2);
		swap(f,f2),swap(g,g2),swap(h,h2);
		R(f),R(g),R(h),R(sf),R(sg),R(sh);
	}
//	outarr(F,0,n);
//	outarr(G,0,n);
//	outarr(H,0,n);
//	outarr(sf,0,n);
//	outarr(sg,0,n);
//	outarr(sh,0,n);
	For(i,0,n){
		Add(ans,(LL)F[i]*sf[n-i]*i%mod);
		Add(ans,(LL)G[i]*sg[n-i]*i%mod);
		Add(ans,(LL)G[i]*sg[n-i]*i%mod);
		Add(ans,(LL)H[i]*sh[n-i]*i%mod);
	}
	cout<<ans<<endl;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;

using Poly = vector<int>;

const int P = 998244353;

Poly operator+(Poly lhs, Poly rhs) {
	Poly ret(max(lhs.size(), rhs.size()), 0);
	for (int i = 0; i < ret.size(); i++) ret[i] = ((i < lhs.size() ? lhs[i] : 0) + (i < rhs.size() ? rhs[i] : 0)) % P;
	return ret;
}

Poly operator-(Poly lhs, Poly rhs) {
	Poly ret(max(lhs.size(), rhs.size()), 0);
	for (int i = 0; i < ret.size(); i++) ret[i] = ((i < lhs.size() ? lhs[i] : 0) + (i < rhs.size() ? P - rhs[i] : 0)) % P;
	return ret;
}

Poly operator*(Poly lhs, Poly rhs) {
	Poly ret(max(0, (int)(lhs.size() + rhs.size()) - 1), 0);
	for (int i = 0; i < lhs.size(); i++) {
		for (int j = 0; j < rhs.size(); j++) {
			ret[i+j] = (ret[i+j] + lhs[i] * 1LL * rhs[j]) % P;
		}
	}
	return ret;
}

Poly shift(Poly p, int k) {
	Poly ret(k, 0); ret.insert(ret.end(), p.begin(), p.end());
	return ret;
}

Poly dot(Poly p) {
	for (int i = 0; i < p.size(); i++) p[i] = 1LL * i * p[i] % P;
	return p;
}

int calc(Poly &a) {
	reverse(a.begin(), a.end());
	int ret = 0;
	while (!a.empty() && !a.back()) a.pop_back(), ret++;
	reverse(a.begin(), a.end());
	return ret;
}

int get_nth(Poly a, Poly b, int n) {
	n -= calc(a) - calc(b);
	if (n < 0) return 0;
	vector<int> c(n + 1, 0);
	for (int i = 0; i <= n; i++) {
		c[i] = i < a.size() ? a[i] : 0;
		for (int j = 1; j < b.size() && j <= i; j++) c[i] = (c[i] + (P - c[i - j]) * 1LL * b[j]) % P;
	}
	return c[n];
}

int main() {
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif
	int n; cin >> n;
	Poly A = {1, 0, P-1, 0, P-1}, B = dot(A), C = dot(B);
	Poly F0 = B * B * (Poly){2} - C * A, F1 = F0 + A * A - B * A * (Poly){2}, F2 = F1 * (Poly){3} - F0 * (Poly){2} + A * (A + B * (Poly){2});
	F0 = A * A * A - shift(F0, 1), F1 = shift(F1, 2), F2 = A * A * A - shift(F2, 3);
	Poly F = F0 * F2 - F1 * F1;
	cout << get_nth(F * (Poly){6} - dot(F) * A, A * F, n) << endl;
	return 0;
}

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define REP(i,n) for(int i=(0);i<(n);i++)
#define pb push_back
using namespace std;
typedef vector<int> vi;
typedef long long ll;

const int N=5005,mod=998244353;
namespace {
	inline int add(int x,int y){
		return x+y>=mod?x+y-mod:x+y;
	}
	inline void Add(int &x,int y){
		x=add(x,y);
	}
	inline int mnu(int x,int y){
		return x-y<0?x-y+mod:x-y;
	}
	inline int mul(int x,int y){
		return (ll)x*y%mod;
	}
	inline int power(int x,ll p){
		int res=1;
		for(;p;p>>=1,x=(ll)x*x%mod)
			if(p&1)res=(ll)res*x%mod;
		return res;
	}
	#define inv(x) power(x,mod-2)
}
namespace LS{
	/*
	note:
	所有下标均从零开始
	a[i]=\sum a[i-j-1]*r[j]
	初值为a[0]..a[sz-1]
	*/
	int p[N],d[N],m;vi s[N];
	vi BM(vi a){
		int n=a.size();
		for(;m;)s[m--].clear();
		REP(i,n){
			d[i]=a[i];
			REP(j,s[m].size())
				d[i]=mnu(d[i],mul(a[i-j-1],s[m][j]));
			if(!d[i])continue;
			p[m]=i;
			if(!m){s[++m].resize(i+1);continue;}
			int id=m-1;
			REP(j,m-1)
				id=(p[j]-s[j].size()>p[id]-s[id].size()?j:id);
			int coef=mul(d[i],inv(d[p[id]]));
			s[++m].resize(i-p[id]-1);
			s[m].pb(coef);
			REP(j,s[id].size())
				s[m].pb(mul(mod-coef,s[id][j]));
			REP(j,s[m-1].size())
				if(j<s[m].size())s[m][j]=add(s[m][j],s[m-1][j]);
				else s[m].pb(s[m-1][j]);
		}
		return s[m];
	}
	const ll Mod=(ll)mod*mod*8;
	#define fix(x) (x>=Mod?x-=Mod:0);
	int A[N],B[N],bin[N],res[N],n;
	inline void Mul(int *x,int *y){
		static ll t[N<<1];
		rep(k,0,n*2-2)t[k]=0;
		REP(i,n)REP(j,n)
			t[i+j]+=(ll)x[i]*y[j],fix(t[i+j]);
		per(i,n*2-2,n){
			t[i]%=mod;
			REP(j,n)t[i-j-1]+=t[i]*A[j],fix(t[i-j-1]);
			t[i]=0;
		}
		REP(i,n)x[i]=t[i]%mod;
	}
	int solve(vi a,vi b,ll K){
		n=a.size();
		if(K<=n-1)return b[K];
		if(n==1)return mul(b[0],power(a[0],K));
		REP(i,n){
			bin[i]=res[i]=0;
			A[i]=a[i],B[i]=b[i];
		}
		bin[1]=res[0]=1;
		for(K-=n-1;K;K>>=1,Mul(bin,bin))
			if(K&1)Mul(res,bin);
		rep(i,n,n*2-2){
			B[i]=0;
			REP(j,n)B[i]=add(B[i],mul(B[i-j-1],A[j]));
		}
		int s=0;
		REP(i,n)s=add(s,mul(B[n-1+i],res[i]));
		return s;
	}
	int gao(vi x,ll K){
		/*
		vi now=BM(x);
		for(auto k:now)
			printf("%d\n",k);
		*/
		return solve(BM(x),x,K);
	}
}

int main(){
	int n;
	while(cin>>n){
		cout<<LS::gao(
{
	0,
	24,
	4,
	240,
	204,
	1316,
	2988,
	6720,
	26200,
	50248,
	174280,
	436904,
	1140888,
	3436404,
	8348748,
	24631232,
	64575924,
	174658944,
	488230244
},
		n-2)<<endl;
	}
	return 0;
}

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define REP(i,n) for(int i=(0);i<(n);i++)
#define pb push_back
using namespace std;
typedef vector<int> vi;
typedef long long ll;

const int N=5005,mod=998244353;
namespace {
	inline int add(int x,int y){
		return x+y>=mod?x+y-mod:x+y;
	}
	inline void Add(int &x,int y){
		x=add(x,y);
	}
	inline int mnu(int x,int y){
		return x-y<0?x-y+mod:x-y;
	}
	inline int mul(int x,int y){
		return (ll)x*y%mod;
	}
	inline int power(int x,ll p){
		int res=1;
		for(;p;p>>=1,x=(ll)x*x%mod)
			if(p&1)res=(ll)res*x%mod;
		return res;
	}
	#define inv(x) power(x,mod-2)
}
namespace LS{
	/*
	note:
	所有下标均从零开始
	a[i]=\sum a[i-j-1]*r[j]
	初值为a[0]..a[sz-1]
	*/
	int p[N],d[N],m;vi s[N];
	vi BM(vi a){
		int n=a.size();
		for(;m;)s[m--].clear();
		REP(i,n){
			d[i]=a[i];
			REP(j,s[m].size())
				d[i]=mnu(d[i],mul(a[i-j-1],s[m][j]));
			if(!d[i])continue;
			p[m]=i;
			if(!m){s[++m].resize(i+1);continue;}
			int id=m-1;
			REP(j,m-1)
				id=(p[j]-s[j].size()>p[id]-s[id].size()?j:id);
			int coef=mul(d[i],inv(d[p[id]]));
			s[++m].resize(i-p[id]-1);
			s[m].pb(coef);
			REP(j,s[id].size())
				s[m].pb(mul(mod-coef,s[id][j]));
			REP(j,s[m-1].size())
				if(j<s[m].size())s[m][j]=add(s[m][j],s[m-1][j]);
				else s[m].pb(s[m-1][j]);
		}
		return s[m];
	}
	const ll Mod=(ll)mod*mod*8;
	#define fix(x) (x>=Mod?x-=Mod:0);
	int A[N],B[N],bin[N],res[N],n;
	inline void Mul(int *x,int *y){
		static ll t[N<<1];
		rep(k,0,n*2-2)t[k]=0;
		REP(i,n)REP(j,n)
			t[i+j]+=(ll)x[i]*y[j],fix(t[i+j]);
		per(i,n*2-2,n){
			t[i]%=mod;
			REP(j,n)t[i-j-1]+=t[i]*A[j],fix(t[i-j-1]);
			t[i]=0;
		}
		REP(i,n)x[i]=t[i]%mod;
	}
	int solve(vi a,vi b,ll K){
		n=a.size();
		if(K<=n-1)return b[K];
		if(n==1)return mul(b[0],power(a[0],K));
		REP(i,n){
			bin[i]=res[i]=0;
			A[i]=a[i],B[i]=b[i];
		}
		bin[1]=res[0]=1;
		for(K-=n-1;K;K>>=1,Mul(bin,bin))
			if(K&1)Mul(res,bin);
		rep(i,n,n*2-2){
			B[i]=0;
			REP(j,n)B[i]=add(B[i],mul(B[i-j-1],A[j]));
		}
		int s=0;
		REP(i,n)s=add(s,mul(B[n-1+i],res[i]));
		return s;
	}
	int gao(vi x,ll K){
		vi now=BM(x);
		for(auto k:now)
			printf("%d\n",k);
		cerr<<now.size()<<endl;
		return solve(BM(x),x,K);
	}
}

int main(){
	int n;
	while(cin>>n){
		cout<<LS::gao(
{
0,
0,
24,
4,
240,
204,
1316,
2988,
6720,
26200,
50248,
174280,
436904,
1140888,
3436404,
8348748,
24631232,
64575924,
174658944,
488230244,
282739095,
583167773,
599201163,
111178790,
470158977,
118436480,
744170002,
418128853,
620410921,
282515603,
777785540,
59207630,
823529776,
886871858,
80677633,
874800287,
754269413,
659807497,
302870971,
307001715
},
		n-1)<<endl;
	}
	return 0;
}

#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll mod=998244353;
const int N=4e5+100;

ll Add(ll x,ll y)
{return (x+y)%mod;}
ll Sub(ll x,ll y)
{return (x-y+mod)%mod;}
ll Mul(ll x,ll y)
{return x*y%mod;}
ll qpow(ll x,ll y=mod-2)
{
	ll res=1;
	while(y)
	{
		if(y&1)res=Mul(res,x);
		x=Mul(x,x),y>>=1;
	}
	return res;
}

ll F[N],G[N];
int wh[N],len,cc;
void ntt(ll *a,bool inv)
{
	for(int i=1;i<len;i++)
		if(i<wh[i])swap(a[i],a[wh[i]]);
	ll tp,mo,ha;
	for(int l=2,md;l<=len;l<<=1)
	{
		md=l>>1,tp=qpow(3,(mod-1)/l);
		for(int i=0;i<len;i+=l)
		{
			mo=1;
			for(int j=0;j<md;j++,mo=Mul(mo,tp))
			{
				ha=Mul(a[i+j+md],mo);
				a[i+j+md]=Sub(a[i+j],ha);
				a[i+j]=Add(a[i+j],ha);
			}
		}
	}
	if(inv)
	{
		tp=qpow(len);
		for(int i=1;i<len/2;i++)swap(a[i],a[len-i]);
		for(int i=0;i<len;i++)a[i]=Mul(a[i],tp);
	}
}
void pre_ntt(int le)
{
	cc=0,len=1;
	while(len<=le)++cc,len<<=1;
	for(int i=1;i<len;i++)
		wh[i]=(wh[i>>1]>>1)|((i&1)<<(cc-1));
}
void clr()
{for(int i=0;i<len;i++)F[i]=G[i]=0;}

int n;
ll f0[N],f1[N],f2[N],g[N];

void sol1(int l,int r)
{
	if(l==r)
	{
		f0[l]=Add(f0[l],Mul(g[l],Mul(l,l)));
		f1[l]=Add(f1[l],Mul(g[l],Mul(l+1,l+1)));
		return;
	}
	int mid=(l+r)>>1;
	sol1(l,mid);
	pre_ntt(mid-l+1+r-l+1);
	clr();//bg f0
	for(int i=l;i<=mid;i++)
		F[i-l]=f0[i];
	for(int i=0;i<=r-l;i++)
		G[i]=Mul(g[i],Mul(i,i));
	ntt(F,0),ntt(G,0);
	for(int i=0;i<len;i++)F[i]=Mul(F[i],G[i]);
	ntt(F,1);
	for(int i=mid+1;i<=r;i++)
		if(i-l-1>=0)f0[i]=Add(f0[i],F[i-l-1]);
	clr();
	for(int i=l;i<=mid;i++)
		F[i-l]=f1[i];
	for(int i=0;i<=r-l;i++)
		G[i]=Mul(g[i],Mul(i+1,i+1));
	//f(l==0&&r==3)cerr<<F[0]<<' '<<G[0]<<'\n';
	ntt(F,0),ntt(G,0);
	for(int i=0;i<len;i++)F[i]=Mul(F[i],G[i]);
	ntt(F,1);
	//if(l==0&&r==3)cerr<<F[0]<<'\n';
	for(int i=mid+1;i<=r;i++)
		if(i-l-3>=0)f0[i]=Add(f0[i],F[i-l-3]);
	clr();//bg f1
	for(int i=l;i<=mid;i++)
		F[i-l]=f0[i];
	for(int i=0;i<=r-l;i++)
		G[i]=Mul(g[i],Mul(i+1,i+1));
	ntt(F,0),ntt(G,0);
	for(int i=0;i<len;i++)F[i]=Mul(F[i],G[i]);
	ntt(F,1);
	for(int i=mid+1;i<=r;i++)
		if(i-l-1>=0)f1[i]=Add(f1[i],F[i-l-1]);
	clr();
	for(int i=l;i<=mid;i++)
		F[i-l]=f1[i];
	for(int i=0;i<=r-l;i++)
		G[i]=Mul(g[i],Mul(i+2,i+2));
	ntt(F,0),ntt(G,0);
	for(int i=0;i<len;i++)F[i]=Mul(F[i],G[i]);
	ntt(F,1);
	for(int i=mid+1;i<=r;i++)
		if(i-l-3>=0)f1[i]=Add(f1[i],F[i-l-3]);
	sol1(mid+1,r);
}

void sol2(int l,int r)
{
	if(l==r)
	{
		f2[l]=Add(f2[l],Mul(g[l],Mul(l+2,l+2)));
		return;
	}
	int mid=(l+r)>>1;
	sol2(l,mid);
	pre_ntt(mid-l+1+r-l+1);
	clr();//bg f2
	for(int i=l;i<=mid;i++)
		F[i-l]=f1[i];
	for(int i=0;i<=r-l;i++)
		G[i]=Mul(g[i],Mul(i+1,i+1));
	ntt(F,0),ntt(G,0);
	for(int i=0;i<len;i++)F[i]=Mul(F[i],G[i]);
	ntt(F,1);
	for(int i=mid+1;i<=r;i++)
		if(i-l-1>=0)f2[i]=Add(f2[i],F[i-l-1]);
	clr();
	for(int i=l;i<=mid;i++)
		F[i-l]=f2[i];
	for(int i=0;i<=r-l;i++)
		G[i]=Mul(g[i],Mul(i+2,i+2));
	//f(l==0&&r==3)cerr<<F[0]<<' '<<G[0]<<'\n';
	ntt(F,0),ntt(G,0);
	for(int i=0;i<len;i++)F[i]=Mul(F[i],G[i]);
	ntt(F,1);
	//if(l==0&&r==3)cerr<<F[0]<<'\n';
	for(int i=mid+1;i<=r;i++)
		if(i-l-3>=0)f2[i]=Add(f2[i],F[i-l-3]);
	sol2(mid+1,r);
}

signed main()
{
	cin>>n;
	g[0]=g[2]=1;
	for(int i=4;i<=n;i++)g[i]=Add(g[i-2],g[i-4]);
	sol1(0,n),sol2(0,n);
	ll ans=0,res;
	ans=Add(ans,(n-1)*(n-1)%mod*g[n-1]%mod*n%mod);
	ans=Add(ans,(n-1)*(n-1)%mod*g[n-3]%mod*n%mod);
//	cout<<f0[1]<<'\n';
	for(int x=0;x<=n-2;x++)
	{
		res=0;
		res=Add(res,Mul(Mul(Mul(x,x),g[x]),f0[n-x-2]));
	//	if(res)cerr<<x<<' '<<res<<'\n';
		if(n-x-3>=0&&x>=1)res=Add(res,2LL*x*x%mod*g[x-1]%mod*f1[n-x-3]%mod);
	//	if(res)cerr<<x<<' '<<res<<'\n';
		if(n-x-4>=0&&x>=2)res=Add(res,1LL*x*x%mod*g[x-2]%mod*f2[n-x-4]%mod);
	//	if(res)cerr<<x<<' '<<res<<'\n';
		ans=Add(ans,Mul(res,x+1));
	//	if(res)cerr<<x<<' '<<res<<'\n';
	}
	printf("%lld\n",ans);
	return 0;
}

#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll mod=998244353;
const int N=2e5+100;

ll Add(ll x,ll y)
{return (x+y)%mod;}
ll Sub(ll x,ll y)
{return (x-y+mod)%mod;}
ll Mul(ll x,ll y)
{return x*y%mod;}
ll qpow(ll x,ll y=mod-2)
{
	ll res=1;
	while(y)
	{
		if(y&1)res=Mul(res,x);
		x=Mul(x,x),y>>=1;
	}
	return res;
}

ll F[N],G[N];
int wh[N],len,cc;
void ntt(ll *a,bool inv)
{
	for(int i=1;i<len;i++)
		if(i<wh[i])swap(a[i],a[wh[i]]);
	ll tp,mo,ha;
	for(int l=2,md;l<=len;l<<=1)
	{
		md=l>>1,tp=qpow(3,(mod-1)/l);
		for(int i=0;i<len;i+=l)
		{
			mo=1;
			for(int j=0;j<md;j++,mo=Mul(mo,tp))
			{
				ha=Mul(a[i+j+md],mo);
				a[i+j+md]=Sub(a[i+j],ha);
				a[i+j]=Add(a[i+j],ha);
			}
		}
	}
	if(inv)
	{
		tp=qpow(len);
		for(int i=1;i<len/2;i++)swap(a[i],a[len-i]);
		for(int i=0;i<len;i++)a[i]=Mul(a[i],tp);
	}
}
void pre_ntt(int le)
{
	cc=0,len=1;
	while(len<le)++cc,len<<=1;
	for(int i=1;i<len;i++)
		wh[i]=(wh[i>>1]>>1)|((i&1)<<(cc-1));
}
void clr()
{for(int i=0;i<len;i++)F[i]=G[i]=0;}

int n;
ll f0[N],f1[N],f2[N],g[N];

void sol1(int l,int r)
{
	if(l==r)
	{
		f0[l]=Add(f0[l],Mul(g[l],Mul(l,l)));
		f1[l]=Add(f1[l],Mul(g[l],Mul(l+1,l+1)));
		return;
	}
	int mid=(l+r)>>1;
	sol1(l,mid);
	pre_ntt(mid-l+1+r-l+1);
	clr();//bg f0
	for(int i=l;i<=mid;i++)
		F[i-l]=f0[i];
	for(int i=0;i<=r-l;i++)
		G[i]=Mul(g[i],Mul(i,i));
	ntt(F,0),ntt(G,0);
	for(int i=0;i<len;i++)F[i]=Mul(F[i],G[i]);
	ntt(F,1);
	for(int i=mid+1;i<=r;i++)
		if(i-l-1>=0)f0[i]=Add(f0[i],F[i-l-1]);
	clr();
	for(int i=l;i<=mid;i++)
		F[i-l]=f1[i];
	for(int i=0;i<=r-l;i++)
		G[i]=Mul(g[i],Mul(i+1,i+1));
	//f(l==0&&r==3)cerr<<F[0]<<' '<<G[0]<<'\n';
	ntt(F,0),ntt(G,0);
	for(int i=0;i<len;i++)F[i]=Mul(F[i],G[i]);
	ntt(F,1);
	//if(l==0&&r==3)cerr<<F[0]<<'\n';
	for(int i=mid+1;i<=r;i++)
		if(i-l-3>=0)f0[i]=Add(f0[i],F[i-l-3]);
	clr();//bg f1
	for(int i=l;i<=mid;i++)
		F[i-l]=f0[i];
	for(int i=0;i<=r-l;i++)
		G[i]=Mul(g[i],Mul(i+1,i+1));
	ntt(F,0),ntt(G,0);
	for(int i=0;i<len;i++)F[i]=Mul(F[i],G[i]);
	ntt(F,1);
	for(int i=mid+1;i<=r;i++)
		if(i-l-1>=0)f1[i]=Add(f1[i],F[i-l-1]);
	clr();
	for(int i=l;i<=mid;i++)
		F[i-l]=f1[i];
	for(int i=0;i<=r-l;i++)
		G[i]=Mul(g[i],Mul(i+2,i+2));
	ntt(F,0),ntt(G,0);
	for(int i=0;i<len;i++)F[i]=Mul(F[i],G[i]);
	ntt(F,1);
	for(int i=mid+1;i<=r;i++)
		if(i-l-3>=0)f1[i]=Add(f1[i],F[i-l-3]);
	sol1(mid+1,r);
}

void sol2(int l,int r)
{
	if(l==r)
	{
		f2[l]=Add(f2[l],Mul(g[l],Mul(l+2,l+2)));
		return;
	}
	int mid=(l+r)>>1;
	sol2(l,mid);
	pre_ntt(mid-l+1+r-l+1);
	clr();//bg f2
	for(int i=l;i<=mid;i++)
		F[i-l]=f1[i];
	for(int i=0;i<=r-l;i++)
		G[i]=Mul(g[i],Mul(i+1,i+1));
	ntt(F,0),ntt(G,0);
	for(int i=0;i<len;i++)F[i]=Mul(F[i],G[i]);
	ntt(F,1);
	for(int i=mid+1;i<=r;i++)
		if(i-l-1>=0)f2[i]=Add(f2[i],F[i-l-1]);
	clr();
	for(int i=l;i<=mid;i++)
		F[i-l]=f2[i];
	for(int i=0;i<=r-l;i++)
		G[i]=Mul(g[i],Mul(i+2,i+2));
	//f(l==0&&r==3)cerr<<F[0]<<' '<<G[0]<<'\n';
	ntt(F,0),ntt(G,0);
	for(int i=0;i<len;i++)F[i]=Mul(F[i],G[i]);
	ntt(F,1);
	//if(l==0&&r==3)cerr<<F[0]<<'\n';
	for(int i=mid+1;i<=r;i++)
		if(i-l-3>=0)f2[i]=Add(f2[i],F[i-l-3]);
	sol2(mid+1,r);
}

signed main()
{
	cin>>n;
	g[0]=g[2]=1;
	for(int i=4;i<=n;i++)g[i]=Add(g[i-2],g[i-4]);
	sol1(0,n),sol2(0,n);
	ll ans=0,res;
	ans=Add(ans,(n-1)*(n-1)%mod*g[n-1]%mod*n%mod);
	ans=Add(ans,(n-1)*(n-1)%mod*g[n-3]%mod*n%mod);
//	cout<<f0[1]<<'\n';
	for(int x=0;x<=n-2;x++)
	{
		res=0;
		res=Add(res,Mul(Mul(Mul(x,x),g[x]),f0[n-x-2]));
	//	if(res)cerr<<x<<' '<<res<<'\n';
		if(n-x-3>=0&&x>=1)res=Add(res,2*x*x%mod*g[x-1]%mod*f1[n-x-3]%mod);
	//	if(res)cerr<<x<<' '<<res<<'\n';
		if(n-x-4>=0&&x>=2)res=Add(res,x*x%mod*g[x-2]%mod*f2[n-x-4]%mod);
	//	if(res)cerr<<x<<' '<<res<<'\n';
		ans=Add(ans,Mul(res,x+1));
	//	if(res)cerr<<x<<' '<<res<<'\n';
	}
	printf("%lld\n",ans);
	return 0;
}