#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    long long m;
    cin >> m;
    long long levo = (m / 4 + 1) % mod, desno = (m / 2 - m / 4 + 1) % mod;
    long long sol = (levo * desno) % mod;
    if (sol < 0) sol += mod;
    cout << sol << "\n";
  }
}
