#include "bits/stdc++.h" #define fastcin {\ cin.tie(0);\ ios::sync_with_stdio(false);\ } using namespace std; int main() { fastcin; int q; cin >> q; int ta[1000001]; ta[1] = ta[2] = ta[3] = 0, ta[4] = 1; int max = 4; for(int i = 0; i < q; i++) { int n; cin >> n; if(n > max) { for(int j = max+1; j < n+1; j++) { ta[j] = (ta[j-1] + ta[j-2] + ta[j-3] + ta[j-4])%17; } max = n; } cout << ta[n] << '\n'; } return 0; }