#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int maxn = 1e6 + 5;
const int N = 2e3 + 5;
const double esp = 1e-6;
inline int read() {
  int X = 0;
  bool flag = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') flag = 0;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    X = (X << 1) + (X << 3) + ch - '0';
    ch = getchar();
  }
  if (flag) return X;
  return ~(X - 1);
}
long long rd() {
  long long x;
  scanf("%lld", &x);
  return x;
}
int main() {
  int t = read();
  while (t--) {
    long long m = rd();
    long long ans = (((m / 4 + 1) % MOD) * ((m / 2 - m / 4 + 1) % MOD)) % MOD;
    printf("%lld\n", ans);
  }
}
