#pragma GCC target("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include #include using namespace std; using i32 = int_fast32_t; using i64 = int_fast64_t; #define rep(i, n) for (i32 i = 0; i < (i32)(n); i++) #define all(a) (a).begin(),(a).end() #define rall(a) (a).rbegin(),(a).rend() using P = pair; constexpr i64 mod = 17; int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); i64 q; cin >> q; vector dp(1000000); dp[3] = 1; for(i32 i = 4; i < 1000000; i++){ dp[i] = (dp[i - 1] + dp[i - 2] + dp[i - 3] + dp[i - 4]) % mod; } rep(i,q){ i32 n; cin >> n; cout << dp[n - 1] << endl; } }