#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
inline int read() {
  int x = 0;
  int f = 0;
  char ch = 0;
  while (!isdigit(ch)) {
    f |= (ch == '-') ? 1 : 0;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = (x << 3) + (x << 1) + (ch ^ 48);
    ch = getchar();
  }
  return f ? -x : x;
}
const int mod = 1e9 + 7;
unsigned long long m;
int t;
int main() {
  t = read();
  while (t--) {
    scanf("%lld", &m);
    printf("%lld\n", (unsigned long long)(m / 2 - m / 4 + 1) % mod *
                         ((m / 4 + 1) % mod) % mod);
  }
}
