#include #include #include #include #include #include #include #include #include using namespace std; typedef long long i64; typedef long double ld; typedef pair P; #define rep(i,s,e) for(int (i) = (s);(i) <= (e);++(i)) int q; int dp[1010101]; int main() { dp[1] = dp[2] = dp[3] = 0; dp[4] = 1; int sum = 1; for(int i = 5;i <= 1010100;i++) { dp[i] = sum; (sum += 17 + dp[i] - dp[i - 4]) %= 17; } cin >> q; for(int i = 0;i < q;i++) { int a; cin >> a; cout << dp[a] << endl; } return 0; }