#include using namespace std; #include using namespace atcoder; using mint = modint998244353; using ll = long long; #define fix(x) fixed << setprecision(x) #define rep(i, n) for(int i = 0; i < n; ++i) #define all(x) (x).begin(),(x).end() templatebool chmin(T&a, const T&b){if(a>b){a=b;return 1;}return 0;} templatebool chmax(T&a, const T&b){if(a vector> MatrixMul(vector> V1, vector> V2, T e){ assert(V1[0].size()==V2.size()); int N = V1.size(), M = V2[0].size(), L = V2.size(); vector> res(N,vector(M,e)); rep(i,N) rep(j,M) rep(k,L) res[i][j] += V1[i][k] * V2[k][j]; return res; } int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); vector> b(7,vector(7,0)), y(7,vector(1,0)); y[0][0] = 1; map mp; mp[1] = 0, mp[2] = 1, mp[4] = 2, mp[8] = 0; mp[-1] = 3, mp[-2] = 4, mp[-4] = 5, mp[-8] = 6; for(int x:{1,-1,2,-2,4,-4,-8}){ for(int y:{1,2,-1,-2}){ if(!mp.count(x*y)) continue; b[mp[x]][mp[x*y]] = 1; } } int t; cin >> t; while(t--){ ll n; cin >> n; mint z = mint(2).pow(n-1); auto x = y; auto a = b; while(n){ if(n&1) x = MatrixMul(a,x,mint(0)); a = MatrixMul(a,a,mint(0)); n >>= 1; } cout << (x[0][0]-z).val() << '\n'; } return 0; }