#include int main() { using namespace std; int q; cin >> q; int n[q]; for (int i = 0; i < q; i++) { cin >> n[i]; } for (int i = 0; i < q; i++) { int r = 0; if (n[i] < 4) { r = 0; } else if (n[i] == 4) { r = 1; } else { int p[4] = {1, 0, 0, 0}; for (int j = 0; j < n[i] - 4; j++) { int tmp = p[0] + p[1] + p[2] + p[3]; p[3] = p[2]; p[2] = p[1]; p[1] = p[0]; p[0] = tmp % 17; } r = p[0]; } cout << r << endl; } }