#include using namespace std; using ll = long long; #define rep(i, s, e) for (int i = (int)(s); i < (int)(e); ++i) #define all(a) (a).begin(),(a).end() int main() { cin.tie(nullptr); ios_base::sync_with_stdio(false); vector T(1e6 + 10); T[1] = T[2] = T[3] = 0; T[4] = 1; rep(i, 5, 1e6 + 10) T[i] = (T[i - 1] + T[i - 2] + T[i - 3] + T[i - 4]) % 17; int Q; cin >> Q; rep(query, 0, Q) { int N; cin >> N; cout << T[N] << '\n'; } }