#include <bits/stdc++.h>
using namespace std;
static const int MOD = 1000000007;
int main() {
  int tt;
  long long m;
  scanf("%d", &tt);
  while (tt--) {
    scanf("%lld", &m);
    printf("%lld\n", ((m / 2 - m / 4 + 1) % MOD) * ((m / 4 + 1) % MOD) % MOD);
  }
  return 0;
}
