#include using namespace std; #define CONST_MOD 998244353LL //#define CONST_MOD 1000000007LL struct ModInt { long long Value; public: ModInt() { Value = 0L; } ModInt(long long value) { Value = value; } ModInt Power(long long exp) const { if (exp <= -1L) { return ModInt(1L) / Power(-exp); } if (exp == 0L) return 1L; if (exp == 1L) return *this; ModInt m = Power(exp / 2L); m = m * m; if (exp % 2L == 1L) { m = m * (*this); } return m; } ModInt Inv() const { return this->Power(CONST_MOD - 2L); } ModInt operator+() const { return *this; } ModInt operator-() const { return ModInt(-Value); } friend ModInt operator+(const ModInt& left, const ModInt& right) { return ModInt(SafeMod(left.Value + right.Value)); } friend ModInt operator+(const ModInt& left, const long long& right) { return ModInt(SafeMod(left.Value + right)); } friend ModInt operator+(const long long& left, const ModInt& right) { return ModInt(SafeMod(left + right.Value)); } ModInt& operator+=(const ModInt& x) { Value += x.Value; Value = SafeMod(Value); return *this; } ModInt& operator+=(const long long& x) { Value += x; Value = SafeMod(Value); return *this; } friend ModInt operator-(const ModInt& left, const ModInt& right) { return ModInt(SafeMod(left.Value - right.Value)); } friend ModInt operator-(const ModInt& left, const long long& right) { return ModInt(SafeMod(left.Value - right)); } friend ModInt operator-(const long long& left, const ModInt& right) { return ModInt(SafeMod(left - right.Value)); } ModInt& operator-=(const ModInt& x) { Value -= x.Value; Value = SafeMod(Value); return *this; } ModInt& operator-=(const long long& x) { Value -= x; Value = SafeMod(Value); return *this; } friend ModInt operator*(const ModInt& left, const ModInt& right) { return ModInt(SafeMod(left.Value * right.Value)); } friend ModInt operator*(const ModInt& left, const long long& right) { return ModInt(SafeMod(left.Value * right)); } friend ModInt operator*(const long long& left, const ModInt& right) { return ModInt(SafeMod(left * right.Value)); } ModInt& operator*=(const ModInt& x) { Value *= x.Value; Value = SafeMod(Value); return *this; } ModInt& operator*=(const long long& x) { Value *= x; Value = SafeMod(Value); return *this; } friend ModInt operator /(const ModInt& left, const ModInt& right) { ModInt inv = right.Inv(); return ModInt(SafeMod(left.Value * inv.Value)); } friend ModInt operator/(const ModInt& left, const long long& right) { return ModInt(SafeMod(left.Value * ModInt(right).Inv().Value)); } friend ModInt operator/(const long long& left, const ModInt& right) { return ModInt(SafeMod(left * right.Inv().Value)); } ModInt& operator/=(const ModInt& x) { Value *= x.Inv().Value; Value = SafeMod(Value); return *this; } ModInt& operator/=(const long long& x) { Value *= ModInt(x).Inv().Value; Value = SafeMod(Value); return *this; } ModInt& operator++() { ++Value; Value = SafeMod(Value); return *this; } ModInt operator++(int) { ModInt temp = *this; Value++; Value = SafeMod(Value); return temp; } ModInt& operator--() { --Value; Value = SafeMod(Value); return *this; } ModInt operator--(int) { ModInt temp = *this; Value--; Value = SafeMod(Value); return temp; } inline static ModInt One() { return ModInt(1L); } static ModInt Combination(long long n, long long r) { ModInt c = 1L; for (ModInt i = 1; i.Value <= r; i++) { c = c * (ModInt(n) - i + ModInt::One()) / i; } return c; } private: inline static long long SafeMod(long long a) { a %= CONST_MOD; if (a < 0) { a += CONST_MOD; } return a; } }; class ModFactorialCache { private: vector _factorial; vector _inverseFactorial; public: ModFactorialCache(int max) { _factorial.resize(max + 1); _inverseFactorial.resize(max + 1); vector inv(max + 1); inv[1] = 1; for (int i = 2; i <= max; i++) { inv[i] = -(CONST_MOD / i) * inv[CONST_MOD % i]; } _factorial[0] = 1; _inverseFactorial[0] = 1; for (long long p = 1; p <= max; p++) { ModInt pm = ModInt(p); _factorial[p] = _factorial[p - 1] * pm; _inverseFactorial[p] = _inverseFactorial[p - 1] * inv[p]; } } ModInt Combination(int n, int r) { return _factorial[n] * (_inverseFactorial[n - r] * _inverseFactorial[r]); } ModInt Permutation(int n, int r) { return _factorial[n] * _inverseFactorial[n - r]; } ModInt Factorial(int n) { return _factorial[n]; } }; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); ModFactorialCache cache(2000050); int T; cin >> T; vector powers = {1}; while (T--) { int N; cin >> N; if (N % 2 == 1) cout << "0\n"; else { if (N == 2) cout << "0\n"; else { N = N / 2 - 1; while (powers.size() <= 2 * N) { powers.push_back(powers[powers.size() - 1] * 2); } ModInt ans = powers[2 * N] - cache.Combination(2 * N + 1, N); cout << ans.Value << "\n"; } } } }