#include #include #include #ifdef LOCAL #include "cpp-dump/dump.hpp" #endif using namespace std; using ll = long long; using mint = atcoder::static_modint<998244353>; constexpr int iINF = 1'000'000'000; constexpr ll llINF = 1'000'000'000'000'000'000; int main () { int T; cin >> T; for (int i = 0; i < T; i++) { int N; cin >> N; if (N == 1) { cout << 1 << "\n"; continue; } if (N == 2) { cout << 3 << "\n"; continue; } mint E = 1; E /= 2; mint not_reach = 3; not_reach /= 4; not_reach = not_reach.pow(N - 2); E *= not_reach; // 余事象が到達可能数 E = 1 - E; mint pr = mint(2).pow(1LL * N * (N - 1) / 2); mint ans = (1 + (N - 1) * E) * pr; cout << ans.val() << "\n"; } }