#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  return x * f;
}
const int mod = 1e9 + 7;
int main() {
  int T = read();
  while (T--) {
    long long m = read();
    printf("%lld\n", (m / 2 - m / 4 + 1) % mod * ((m / 4 + 1) % mod) % mod);
  }
  return 0;
}
