#include typedef long long ll; using namespace std; int INF = 1LL << 30; int MOD = 1e9+7; int dp[1000000] = {0,0,0,1}; main(){ for(int i = 4;i < 1000000;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++){ int a; cin >> a; cout << dp[a-1] << endl;; } }