#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll KMOD = 1000000007;
ll madd(ll a, ll b) { return (a + b) % KMOD; }
ll msub(ll a, ll b) { return (a - b + KMOD) % KMOD; }
ll mmul(ll a, ll b) { return a * b % KMOD; }
ll mmul(ll a, ll b, ll c) { return mmul(a, mmul(b, c)); }
ll mmul(ll a, ll b, ll c, ll d) { return mmul(mmul(a, b), mmul(c, d)); }
ll SumFirstNTerms(ll n) {
  ll b = ((n - 1) / 2) % KMOD;
  if (n % 2 == 0) {
    return mmul(b, b + 1);
  }
  return mmul(b, b);
}
ll Solve(ll m) {
  if (m % 2 == 0) {
    return madd(m / 2 + 1, SumFirstNTerms(m / 2 + 1));
  }
  return madd(m / 2 + 1, SumFirstNTerms((m + 1) / 2));
}
int main() {
  int t;
  scanf("%d", &t);
  for (int i = 0; i < t; ++i) {
    ll m;
    scanf("%lld", &m);
    printf("%lld\n", Solve(m));
  }
}
