#include <bits/stdc++.h>
const int md = 1e9 + 7;
const long long inf = 2e18;
const int OO = 1;
const int OOO = 1;
using namespace std;
void solve() {
  long long m;
  cin >> m;
  if (m == 1) {
    cout << "1\n";
    return;
  }
  long long n = m / 2;
  if (n & 1) {
    long long x = (n / 2 + 1) % md;
    cout << x * (x + 1) % md << '\n';
  } else {
    long long x = (n / 2 + 1) % md;
    cout << x * x % md << '\n';
  }
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  int t;
  cin >> t;
  while (t--) solve();
}
