#include <bits/stdc++.h>   using namespace std;   const int maxn = 3e6 + 7;   const int mod = 1e9 + 7;   long long int dp[maxn] = {0};   int main() {     int t;     cin >> t;     dp[1] = 0;     dp[2] = 0;     dp[3] = 1;     for (int i = 4; i < maxn; i++) {       dp[i] = 2 * dp[i - 2] + dp[i - 1];       if (i % 3 == 0) dp[i]++;       dp[i] %= mod;     }     while (t--) {       int n;       cin >> n;       cout << (dp[n] * 4 + mod) % mod << endl;     }   }   