#include #define rep(i,n) for(int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main(){ cin.tie(0); ios::sync_with_stdio(0); int MAX_N = 1010101; vector dp(MAX_N + 1, 0); dp[1] = 0, dp[2] = 0, dp[3] = 0, dp[4] = 1; for(int i = 5; i <= MAX_N; i++) dp[i] = (dp[i - 1] + dp[i - 2] + dp[i - 3] + dp[i - 4]) % 17; int Q; cin >> Q; rep(_,Q) { int n; cin >> n; cout << dp[n] << "\n"; } }