#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
long long mul(long long x, long long y) {
  return ((x % MOD) * (y % MOD)) % MOD;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  long long n;
  cin >> t;
  while (t--) {
    cin >> n;
    if (n == 1) {
      cout << "1\n";
      continue;
    }
    long long a = n / 2, b = a / 2;
    if (a % 2 == 0)
      cout << mul(b + 1, b + 1) << '\n';
    else
      cout << mul(b + 2, b + 1) << '\n';
  }
  return 0;
}
