#include #define rep(i,a,b) for(int i=a;i<(b);++i) #define erep(i,a,b) for(int i=a;i<=(int)(b);++i) #define per(i,a,b) for(int i=(a);i>(b);--i) #define eper(i,a,b) for(int i=(a);i>=b;--i) #define pb push_back #define mp make_pair #define INF (1<<31)-1 #define MOD 17 #define all(x) (x).begin(),(x).end() #define vii vector #define vll vector using namespace std; typedef long long ll; typedef pair Pii; templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b> q; memset(dp, 0, sizeof(dp)); rep(i, 0, 4) dp[i] = 0; dp[4] = 1; rep(i, 5, 1000005) { dp[i] = (dp[i-1] % MOD) + (dp[i-2] % MOD) + (dp[i-3] % MOD) + (dp[i-4] % MOD); } while (q--) { int p; cin >> p; cout << dp[p] % MOD << endl; } return 0; }