#include <bits/stdc++.h>
using namespace std;
long long Read() {
  long long val = 0, opt = 1;
  char ch;
  while (!isdigit(ch = getchar()))
    if (ch == '-') opt = -1;
  while (isdigit(ch)) (val *= 10) += ch - '0', ch = getchar();
  return val * opt;
}
int main(void) {
  int T = Read();
  while (T--) {
    long long m = Read();
    printf("%lld\n", (m / 4 + 1) % 1000000007 *
                         ((m / 2 - m / 4 + 1) % 1000000007) % 1000000007);
  }
}
