# include # include # include # include # include # include # include # include # include # include # include # include # include # include # include #include #include #include #include #include using namespace std; typedef long long int ll; const int N = 1000000; const ll INF = std::numeric_limits::max(); #define rep(i,n) for(ll i=(ll)0;i<(ll)n;++i) #define ALL(x) x.begin(),x.end() #define pp pair #define fi first #define se second #define sz size const ll mod = 17; string YN(bool b) { return(b ? "YES" : "NO"); } string yn(bool b) { return(b ? "Yes" : "No"); } ll q, v[1000001],n; int main() { cin >> q; v[0] = 0; v[1] = 0; v[2] = 0; v[3] = 1; for (ll i = 4; i < 1000001; ++i) { v[i] = v[i - 1] + v[i - 2] + v[i - 3] + v[i - 4]; v[i] %= mod; } rep(i, q) { cin >> n; cout << v[n - 1] << endl; } return 0; }