#include typedef long long ll; using namespace std; int INF = 1LL << 30; int MOD = 1e9+7; const int K = 4912; ll dp[K] = {0,0,0,1}; main(){ for(int i = 4;i < K;i++){ dp[i] = (dp[i-4] + dp[i-3] + dp[i-2] + dp[i-1]) % 17; } int N; cin >> N; for(int i = 0;i < N;i++){ ll a; cin >> a; cout << dp[(a+K-1) % K] << endl;; } }