#include #include int main() { std::cin.tie(0); std::ios::sync_with_stdio(false); int q; std::cin >> q; std::vector list; int t1 = 0, t2 = 0, t3 = 0, t4 = 1; list.push_back(0); list.push_back(0); list.push_back(0); list.push_back(1); for(int i = 0; i < q; i++) { long long n; std::cin >> n; if(n > list.size()) { for(long long j = list.size(); j < n; j++) { int t = t1 + t2 + t3 + t4; t %= 17; list.push_back(t); t1 = t2; t2 = t3; t3 = t4; t4 = t; } } std::cout << list[n - 1] << "\n"; } return 0; }