#include using namespace std; int dp[1000006]; int main() { int q; cin >> q; dp[0] = 0; dp[1] = 0; dp[2] = 0; dp[3] = 1; for (int i = 4; i < 1000005; ++i) { dp[i] = dp[i - 1] + dp[i - 2] + dp[i - 3] + dp[i - 4]; dp[i] %= 17; } while (q--) { int n; cin >> n; cout << dp[n - 1] << endl; } return 0; }