#include <bits/stdc++.h>
const long long mod = 1e9 + 7;
const long long inv2 = (mod + 1) / 2;
const long long lim = 1e6;
long long x = 0, ans = 0;
void solve() {
  ans = 0;
  scanf("%lld", &x);
  x -= x & 1;
  long long cnt = x / 4 + 1;
  ans = (((cnt - 1)) % mod * ((cnt) % mod) % mod + cnt) % mod;
  if (x % 4) ans = (ans + cnt) % mod;
  printf("%lld\n", ans % mod);
}
int main() {
  int t;
  scanf("%d", &t);
  while (t--) solve();
  return 0;
}
