#include <bits/stdc++.h>
const long long MOD = 1e9 + 7;
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    long long _n;
    cin >> _n;
    __int128 n = _n;
    n /= 2;
    __int128 val = (n / 2 + 1) * (n / 2 + 1);
    if (n % 2 == 0) cout << (long long)(val % MOD) << '\n';
    if (n % 2 == 1) cout << (long long)((val + (n / 2 + 1)) % MOD) << '\n';
  }
  return 0;
}
