#include <iostream>
using namespace std;
#define MOD 1000000007
/*ifstream fin(“file.in”);
ofstream fout(“file.out”);*/
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
long long sum;
long long a, a1, a2, a3, x;
long long k1, k2;
long long fact2, fact4;
cin >> n;
for(int i = 1; i <= n; ++i){
cin >> x;
sum = 1;
k1 = x, k2 = x – 1;
a = x, a1 = x – 1, a2 = x – 2, a3 = x – 3;
if(k1 % 2 == 0)
k1 /= 2;
else k2 /= 2;
if(a % 2 0 && a % 4 != 0)
a /= 2;
else if(a1 % 2 0 && a1 % 4 != 0)
a1 /= 2;
else if(a2 % 2 == 0 && a2 % 4 != 0)
a2 /= 2;
else a3 /= 2;
if(a % 3 0)
a /= 3;
else if(a1 % 3 0)
a1 /= 3;
else if(a2 % 3 == 0)
a2 /= 3;
else a3 /= 3;
if(a % 4 0)
a /= 4;
else if(a1 % 4 0)
a1 /= 4;
else if(a2 % 4 == 0)
a2 /= 4;
else a3 /= 4;
fact2 = (k1 * k2) %
MOD;
fact4 = (((a * a1) %
MOD) * ((a2 * a3) %
MOD)) %
MOD;
sum += (fact2 + fact4) %
MOD;
cout << sum << ‘\n’;
}
}