#include <bits/stdc++.h>
using namespace std;
namespace IO {
const int sz = 1 << 15;
char inbuf[sz], outbuf[sz];
char *pinbuf = inbuf + sz;
char *poutbuf = outbuf;
inline char _getchar() {
  if (pinbuf == inbuf + sz) fread(inbuf, 1, sz, stdin), pinbuf = inbuf;
  return *(pinbuf++);
}
inline void _putchar(char x) {
  if (poutbuf == outbuf + sz) fwrite(outbuf, 1, sz, stdout), poutbuf = outbuf;
  *(poutbuf++) = x;
}
inline void flush() {
  if (poutbuf != outbuf)
    fwrite(outbuf, 1, poutbuf - outbuf, stdout), poutbuf = outbuf;
}
}  // namespace IO
inline int read() {
  int v = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    v = v * 10 + c - '0';
    c = getchar();
  }
  return v * f;
}
const int mod = 1e9 + 7;
int dp[64][3];
int C[4][4];
void Add(int &X, int Y) {
  X += Y;
  if (X >= mod) X -= mod;
}
void mian() {
  long long x;
  scanf("%lld", &x);
  long long iv2 = (mod + 1) / 2;
  x >>= 1;
  long long ans = 0;
  if (x & 1) {
    x >>= 1;
    ans = ((x + 2) % mod) * ((x + 1) % mod) % mod;
  } else {
    x >>= 1;
    ans = ((x + 1) % mod) * ((x + 1) % mod) % mod;
  }
  printf("%lld\n", ans);
}
int main() {
  int T = read();
  while (T--) {
    mian();
  }
}
