#include #include #include #include #include #include #include #include #include static const int MOD = 17; using ll = long long; using u32 = unsigned; using namespace std; template constexpr T INF = ::numeric_limits::max() / 32 * 15 + 208; int main() { int q; cin >> q; array v{}; v[3] = 1; for (int i = 4; i <= 5000; ++i) { (v[i] = v[i-1] + v[i-2] + v[i-3] + v[i-4]) %= MOD; } for (int i = 0; i < q; ++i) { ll k; scanf("%lld", &k); printf("%d\n", v[(k-1)%4912]); } return 0; }