#include <bits/stdc++.h>
using namespace std;
long long read() {
  long long X = 0, w = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') w = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') X = X * 10 + c - '0', c = getchar();
  return X * w;
}
const int mod = 1e9 + 7;
int main() {
  int T = read();
  while (T--) {
    long long n = read() / 2 + 1;
    if (n & 1)
      printf("%d\n", (((n + 1) / 2) % mod) * (((n + 1) / 2) % mod) % mod);
    else
      printf("%d\n", ((n / 2) % mod) * ((n / 2 + 1) % mod) % mod);
  }
  return 0;
}
