#define _USE_MATH_DEFINES #include using namespace std; signed main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } int mx = *max_element(a.begin(), a.end()); int t[mx + 1] = {}; for (int i = 1; i <= mx; i++) { if (i == 1 || i == 2 || i == 3) t[i] = 0; else if (i == 4) t[i] = 1; else { t[i] = t[i - 1] + t[i - 2] + t[i - 3] + t[i - 4]; t[i] %= 17; } } for (int i = 0; i < n; i++) { cout << t[a[i]] << '\n'; } return 0; }