#include #include #include #include #include #include #include #include #include using namespace std; int main() { int Q; cin >> Q; int n; int T[1000001] = {0}; T[1] = 0; T[2] = 0; T[3] = 0; T[4] = 1; for (int j = 5; j < 1000001; ++j) { for (int i = 1; i < 5; ++i) { T[j] += T[j - i] % 17; } T[j] = T[j] % 17; } for (int i = 0; i < Q; ++i) { cin >> n; cout << T[n] << "\n"; } return 0; }