#include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
const int mod = 1000000007;
inline int add(int x, int y) {
  int z = x + y;
  if (z >= mod) {
    z -= mod;
  }
  return z;
}
inline int sub(int x, int y) {
  int z = x + mod - y;
  if (z >= mod) {
    z -= mod;
  }
  return z;
}
inline int mul(int x, int y) { return (x * ll(y)) % mod; }
inline int get(int x) { return mul(mul(x, add(x, 1)), 500000004); }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int t;
  cin >> t;
  while (t--) {
    ll n;
    cin >> n;
    n /= 2;
    ++n;
    ll a = n / 2;
    ll b = (n + 1) / 2;
    cout << add(get(a % mod), get(b % mod)) << "\n";
  }
}
