#include #include #include #include #include #include using namespace std; #define ll long long ll memo[1000001]={}; ll tetora(ll n){ if(n<4) return 0; else if(n==4) return 1; if(memo[n]==0) memo[n] = (tetora(n-1)+tetora(n-2)+tetora(n-3)+tetora(n-4))%17; return memo[n]; } int main(){ ll Q,num; cin >> Q; while(Q--){ cin >> num; cout << tetora(num) << endl; } return 0; }