/****************************************** * AUTHOR: BHUVNESH JAIN * * INSTITUITION: BITS PILANI, PILANI * ******************************************/ #include using namespace std; typedef long long LL; typedef long double LD; typedef pair pii; typedef pair pll; int add(int a, int b, int c) { int res = a + b; return (res >= c ? res - c : res); } int mod_neg(int a, int b, int c) { int res; if(abs(a-b) < c) res = a - b; else res = (a-b) % c; return (res < 0 ? res + c : res); } int mul(int a, int b, int c) { long long res = (long long)a * b; return (res >= c ? res % c : res); } int power(long long a, long long n, int m) { int x = 1, p = a % m; while(n) { if(n & 1) x = mul(x, p, m); p = mul(p, p, m); n >>= 1; } return x; } template T extended_euclid(T a, T b, T &x, T &y) { T xx = 0, yy = 1; y = 0; x = 1; while(b) { T q = a / b, t = b; b = a % b; a = t; t = xx; xx = x - q * xx; x = t; t = yy; yy = y - q * yy; y = t; } return a; } template T mod_inverse(T a, T n) { T x, y, z = 0; T d = extended_euclid(a, n, x, y); return (d > 1 ? -1 : mod_neg(x, z, n)); } const int mod = 663224321; const int mod2 = mod - 1; const int MAX = 1e5 + 5; int dp[MAX]; int p2[MAX]; int fact[MAX], invp[MAX]; void init() { fact[0] = 1, invp[0] = 1; for(int i = 1; i < MAX; ++i) { fact[i] = mul(fact[i-1], i, mod); } invp[MAX-1] = mod_inverse(fact[MAX-1], mod); for(int i = MAX-2; i >= 1; --i) { invp[i] = mul(invp[i+1], i+1, mod); } p2[1] = 0; for(int i = 1; i < MAX; ++i) { int w = ((LL)i * (i-1) / 2LL) % mod2; p2[i] = power(2, w, mod); } } int ncr(int n, int r) { if (r < 0 || r > n) return 0; return mul(fact[n], mul(invp[n-r], invp[r], mod), mod); } int solve(int n) { if (n == 0) { return 1; } int &res = dp[n]; if (res == -1) { res = 0; res = p2[n]; int g = 0; for(int k = 1; k < n; ++k) { int u = mul(k, ncr(n, k), mod); u = mul(u, p2[n-k], mod); int q = solve(k); u = mul(u, q, mod); g = add(g, u, mod); } g = mul(g, mod_inverse(n, mod), mod); res -= g; if (res < 0) res += mod; } return res; } int main() { #ifndef ONLINE_JUDGE // freopen("inp.txt", "r", stdin); #endif init(); fill(dp, dp + MAX, -1); int t, n; scanf("%d", &t); while(t--) { scanf("%d", &n); int ans = solve(n); printf("%d\n", ans); } return 0; }