#include #include int main(void) { int i, j, a[5], Q, n, Max; scanf("%d", &Q); int *b = (int *)calloc(Q, sizeof(int)); for (j = 0; j < Q; j++) { scanf("%d", &n); b[j] = n; Max = 0; if (b[j] > Max) { Max = b[j]; } } int *c = (int *)calloc(Max, sizeof(int)); c[0] = 0; c[1] = 0; c[2] = 0; c[3] = 1; for (i = 0; i < Max - 3; i++) { c[i + 4] = (c[i+3] + c[i+2] + c[i+1] + c[i]) % 17; } for (j = 0; j < Q; j++) { printf("%d", c[b[j]-1]); printf("\n"); } return 0; }