#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  long long m = 1;
  while (t--) {
    cin >> m;
    if (m < 2)
      cout << "1\n";
    else if (m % 4 > 1) {
      cout << ((((((m + 2) / 4 + 1) % (((long long)1e9) + 7)) *
                     (((m + 2) / 4 + 1) % (((long long)1e9) + 7)) -
                 (m + 2) / 4 - 1) %
                (((long long)1e9) + 7)) +
               (((long long)1e9) + 7)) %
                  (((long long)1e9) + 7)
           << "\n";
    } else {
      cout << ((((m + 2) / 4 + 1) % (((long long)1e9) + 7)) *
               (((m + 2) / 4 + 1) % (((long long)1e9) + 7))) %
                  (((long long)1e9) + 7)
           << "\n";
    }
  }
}
