#include int tetora(int n){ int num; if(n == 1){ num = 0; }else if(n == 2){ num = 0; }else if(n == 3){ num = 0; }else if(n == 4){ num = 1; }else{ num = tetora(n-1)+tetora(n-2)+tetora(n-3)+tetora(n-4); } return num; } int main(void){ int Q; int i,t,tmp,sum = 0; scanf("%d", &Q); int box[Q]; for(i = 0; i < Q; i++){ scanf("%d",&t); box[i] = tetora(t); } for(i = 0; i < Q; i++){ printf("%d\n",box[i]%17); } return 0; }