/* ======================================================================== $File: $ $Date: $ $Revision: $ $Creator: Creative GP $ $Notice: (C) Copyright 2017 by Creative GP, Inc. All Rights Reserved. $ ======================================================================== */ #define CPP #include #include #include #include #include #include #define ll long long using namespace std; map memo = { {1, 0}, {2, 0}, {3, 0}, {4, 1} }; int tetra(ll n) { if (memo.find(n) != memo.end()) return memo[n]; memo[n] = tetra(n-1)+tetra(n-2)+tetra(n-3)+tetra(n-4); return memo[n]; } int main() { ll Q; cin >> Q; for (ll i = 0; i < Q; i++) { int t; cin >> t; cout << tetra(t) % 17 << endl; } }