#include using namespace std; const int MM = 998244353; long modpow(long a, long b, long mod) { if (b == 0) { return 1; } if ((b & 1) == 0) { return modpow((a * a) % mod, b >> 1, mod); } return (a * modpow(a, b - 1, mod)) % mod; } int main() { int N; cin >> N; vector A(N+1); for (int i=0; i> A[i]; vector two(N+1); two[0] = 1; for (int i=1; i> I(N+5, vector(3)); I[0][2] = modpow(6, MM-2, MM); I[0][0] = 0; I[0][1] = 0; I[1][0] = 1; I[1][1] = modpow(-2, MM-2, MM)+MM; I[1][2] = 0; for (int i=1; i<(N+1)/2; i++) { I[2*i+1][0] = (2*i*I[2*i-1][0] % MM) * modpow(2*i+1, MM-2, MM) % MM; I[2*i+1][1] = ((2*i*I[2*i-1][1] % MM) * modpow(2*i+1, MM-2, MM) - modpow(two[2*i+1], MM-2, MM)) % MM; if (I[2*i+1][1] < 0) I[2*i+1][1] += MM; I[2*i+1][2] = (2*i*I[2*i-1][2] % MM) * modpow(2*i+1, MM-2, MM) % MM; I[2*i][0] = ((2*i-1)*I[2*i-2][0] % MM) * modpow(2*i, MM-2, MM) % MM; I[2*i][1] = (((2*i-1)*I[2*i-2][1] % MM) * modpow(2*i, MM-2, MM) - modpow(two[2*i], MM-2, MM)) % MM; if (I[2*i][1] < 0) I[2*i][1] += MM; I[2*i][2] = ((2*i-1)*I[2*i-2][2] % MM) * modpow(2*i, MM-2, MM) % MM; } long a, b, c = 0; for (int i=0; i