stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include <iostream>

#include <algorithm>

#include <iomanip>

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#include <math.h>

#include <vector>

#include <string>

#include <queue>

#include <deque>

#include <list>

#include <set>

#include <unordered_set>

#include <map>

#include <unordered_map>

#include <bitset>

#include <random>

#include <complex>

#include <assert.h>



using namespace std;

typedef long long ll;

#define endl '\n'



/////////////         modの計算



#define MOD_IS_PRIME

constexpr ll mod = 1000000007LL;



int main() {

	ios::sync_with_stdio(false);

	std::cin.tie(0);



	constexpr int K = 16;



	vector<ll> v_e = { 0, 765144583, 346175634, 347662323, 5655049, 184117322, 927321758, 444014759, 542573865, 237315285, 417297686, 471090892, 183023413, 660103155, 727008098, 869418286 };

	vector<ll> v_o = { 539588932, 729548371, 700407153, 404391958, 962779130, 184117322, 927321758, 444014759, 542573865, 237315285, 417297686, 471090892, 183023413, 660103155, 727008098, 869418286 };



	int T; cin >> T;

	for (int _t = 0; _t < T; _t++) {

		ll N; cin >> N;

		if (N % 2 == 0) {// even

			ll ans = 0;

			ll x = 1;

			for (int i = 0; i < K; i++) {

				ans += (x * v_e[i]) % mod;

				x = (x * N) % mod;

			}

			cout << ans % mod << endl;

		}

		else {// odd

			ll ans = 0;

			ll x = 1;

			for (int i = 0; i < K; i++) {

				ans += (x * v_o[i]) % mod;

				x = (x * N) % mod;

			}

			cout << ans % mod << endl;

		}

	}



	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.272290351025091x):
#include <stdio.h>



typedef long long ll;



/////////////         modの計算

const ll mod = 1000000007LL;



class modlong {

public:

	modlong() { x = 0; }

	modlong(ll num) { x = num; }

	inline operator ll() const { return x; }

	inline void operator = (ll num) { x = num; }

	inline void operator += (ll num) { x += num; }

	inline void operator *= (ll num) { x = adjust(x * num); }

	inline modlong operator * (ll num) { modlong m(adjust(x * num)); return m; }

	inline ll adjust(ll a) {

		if (a >= mod) { return a % mod; }

		return a;

	}

	ll x;

};



constexpr int K = 16;



constexpr ll v_e[] = { 0, 765144583, 346175634, 347662323, 5655049, 184117322, 927321758, 444014759, 542573865, 237315285, 417297686, 471090892, 183023413, 660103155, 727008098, 869418286 };

constexpr ll v_o[] = { 539588932, 729548371, 700407153, 404391958, 962779130, 184117322, 927321758, 444014759, 542573865, 237315285, 417297686, 471090892, 183023413, 660103155, 727008098, 869418286 };



int main() {

	int T; scanf("%d", &T);

	for (int _t = 0; _t < T; _t++) {

		ll N; scanf("%ld", &N);

		modlong ans = 0;

		modlong x = 1;



		if (N & 1) {// odd

			for (int i = 0; i < K; i++) {

				ans += x * v_o[i];

				x *= N;

			}

		}

		else {// even

			for (int i = 0; i < K; i++) {

				ans += x * v_e[i];

				x *= N;

			}

		}

		printf("%ld\n", ans.x % mod);

	}



	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <algorithm>

#include <iomanip>

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#include <math.h>

#include <vector>

#include <string>

#include <queue>

#include <deque>

#include <list>

#include <set>

#include <unordered_set>

#include <map>

#include <unordered_map>

#include <bitset>

#include <random>

#include <complex>

#include <assert.h>



using namespace std;

typedef long long ll;

#define endl '\n'



/////////////         modの計算



#define MOD_IS_PRIME

constexpr ll mod = 1000000007LL;



int main() {

	ios::sync_with_stdio(false);

	std::cin.tie(0);



	constexpr int K = 16;



	vector<ll> v_e = { 0, 765144583, 346175634, 347662323, 5655049, 184117322, 927321758, 444014759, 542573865, 237315285, 417297686, 471090892, 183023413, 660103155, 727008098, 869418286 };

	vector<ll> v_o = { 539588932, 729548371, 700407153, 404391958, 962779130, 184117322, 927321758, 444014759, 542573865, 237315285, 417297686, 471090892, 183023413, 660103155, 727008098, 869418286 };



	int T; cin >> T;

	for (int _t = 0; _t < T; _t++) {

		ll N; cin >> N;

		if (N % 2 == 0) {// even

			ll ans = 0;

			ll x = 1;

			for (int i = 0; i < K; i++) {

				ans += x * v_e[i];

				x *= N;

				if (ans >= mod) { ans %= mod; }

				if (x >= mod) { x %= mod; }

			}

			cout << ans << endl;

		}

		else {// odd

			ll ans = 0;

			ll x = 1;

			for (int i = 0; i < K; i++) {

				ans += x * v_o[i];

				x *= N;

				if (ans >= mod) { ans %= mod; }

				if (x >= mod) { x %= mod; }

			}

			cout << ans << endl;

		}

	}



	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.276685812599226x):
#include <stdio.h>



typedef long long ll;



/////////////         modの計算

const ll mod = 1000000007LL;



class modlong {

public:

	modlong() { x = 0; }

	modlong(ll num) { x = num; }

	inline operator ll() const { return x; }

	inline void operator = (ll num) { x = num; }

	inline void operator += (ll num) { x += num; }

	inline void operator *= (ll num) { x = adjust(x * num); }

	inline modlong operator * (ll num) { modlong m(adjust(x * num)); return m; }

	inline ll adjust(ll a) {

		if (a >= mod) { return a % mod; }

		return a;

	}

	ll x;

};



constexpr int K = 16;



constexpr ll v_e[] = { 0, 765144583, 346175634, 347662323, 5655049, 184117322, 927321758, 444014759, 542573865, 237315285, 417297686, 471090892, 183023413, 660103155, 727008098, 869418286 };

constexpr ll v_o[] = { 539588932, 729548371, 700407153, 404391958, 962779130, 184117322, 927321758, 444014759, 542573865, 237315285, 417297686, 471090892, 183023413, 660103155, 727008098, 869418286 };



int main() {

	int T; scanf("%d", &T);

	for (int _t = 0; _t < T; _t++) {

		ll N; scanf("%ld", &N);

		modlong ans = 0;

		modlong x = 1;



		if (N & 1) {// odd

			for (int i = 0; i < K; i++) {

				ans += x * v_o[i];

				x *= N;

			}

		}

		else {// even

			for (int i = 0; i < K; i++) {

				ans += x * v_e[i];

				x *= N;

			}

		}

		printf("%ld\n", ans.x % mod);

	}



	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <algorithm>

#include <iomanip>

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#include <math.h>

#include <vector>

#include <string>

#include <queue>

#include <deque>

#include <list>

#include <set>

#include <unordered_set>

#include <map>

#include <unordered_map>

#include <bitset>

#include <random>

#include <complex>

#include <assert.h>



using namespace std;

typedef long long ll;



constexpr ll mod = 1000000007;

constexpr ll v[] = { 0, 765144583, 346175634, 347662323, 5655049, 184117322, 927321758, 444014759, 542573865, 237315285, 417297686, 471090892, 183023413, 660103155, 727008098, 539588932, 729548371, 700407153, 404391958, 962779130, 184117322, 927321758, 444014759, 542573865, 237315285, 417297686, 471090892, 183023413, 660103155, 727008098 };



int main() {

	int N, T; scanf("%d", &T);

	for (int _t = 0; _t < T; _t++) {

		scanf("%d", &N);

		ll ans = 869418286;

		if (N & 1) {// odd

			for (int i = 14, j = 29; i >= 0; i--, j--) {

				ans = (ans * N + v[j]) % mod;

			}

		}

		else {// even

			for (int i = 14; i >= 0; i--) {

				ans = (ans * N + v[i]) % mod;

			}

		}

		printf("%d\n", ans);

	}



	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.087767032865756x):
#include <stdio.h>



typedef long long ll;



/////////////         modの計算

const ll mod = 1000000007LL;



class modlong {

public:

	modlong() { x = 0; }

	modlong(ll num) { x = num; }

	inline operator ll() const { return x; }

	inline void operator = (ll num) { x = num; }

	inline void operator += (ll num) { x += num; }

	inline void operator *= (ll num) { x = adjust(x * num); }

	inline modlong operator * (ll num) { modlong m(adjust(x * num)); return m; }

	inline ll adjust(ll a) {

		if (a >= mod) { return a % mod; }

		return a;

	}

	ll x;

};



constexpr int K = 16;



constexpr ll v_e[] = { 0, 765144583, 346175634, 347662323, 5655049, 184117322, 927321758, 444014759, 542573865, 237315285, 417297686, 471090892, 183023413, 660103155, 727008098, 869418286 };

constexpr ll v_o[] = { 539588932, 729548371, 700407153, 404391958, 962779130, 184117322, 927321758, 444014759, 542573865, 237315285, 417297686, 471090892, 183023413, 660103155, 727008098, 869418286 };



int main() {

	int T; scanf("%d", &T);

	for (int _t = 0; _t < T; _t++) {

		ll N; scanf("%ld", &N);

		modlong ans = 0;

		modlong x = 1;



		if (N & 1) {// odd

			for (int i = 0; i < K; i++) {

				ans += x * v_o[i];

				x *= N;

			}

		}

		else {// even

			for (int i = 0; i < K; i++) {

				ans += x * v_e[i];

				x *= N;

			}

		}

		printf("%ld\n", ans.x % mod);

	}



	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <algorithm>

#include <iomanip>

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#include <math.h>

#include <vector>

#include <string>

#include <queue>

#include <deque>

#include <list>

#include <set>

#include <unordered_set>

#include <map>

#include <unordered_map>

#include <bitset>

#include <random>

#include <complex>

#include <assert.h>



using namespace std;

typedef long long ll;

#define endl '\n'



const ll mod = 1000000007LL;



int main() {

	ios::sync_with_stdio(false);

	std::cin.tie(0);



	constexpr int K = 16;



	constexpr ll v_e[] = { 869418286, 727008098, 660103155, 183023413, 471090892, 417297686, 237315285, 542573865, 444014759, 927321758, 184117322, 5655049, 347662323, 346175634, 765144583, 0};

	constexpr ll v_o[] = { 869418286, 727008098, 660103155, 183023413, 471090892, 417297686, 237315285, 542573865, 444014759, 927321758, 184117322, 962779130, 404391958, 700407153, 729548371, 539588932 };



	ll T, N; cin >> T;

	for (int _t = 0; _t < T; _t++) {

		cin >> N;

		ll ans = v_e[0];

		if (N & 1) {// odd

			for (int i = 1; i < K; i++) {

				ans *= N;

				ans += v_o[i];

				ans %= mod;

			}

		}

		else {// even

			for (int i = 1; i < K; i++) {

				ans *= N;

				ans += v_e[i];

				ans %= mod;

			}

		}

		cout << ans << endl;

	}



	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.210178113373833x):
#include <stdio.h>



typedef long long ll;



/////////////         modの計算

const ll mod = 1000000007LL;



class modlong {

public:

	modlong() { x = 0; }

	modlong(ll num) { x = num; }

	inline operator ll() const { return x; }

	inline void operator = (ll num) { x = num; }

	inline void operator += (ll num) { x += num; }

	inline void operator *= (ll num) { x = adjust(x * num); }

	inline modlong operator * (ll num) { modlong m(adjust(x * num)); return m; }

	inline ll adjust(ll a) {

		if (a >= mod) { return a % mod; }

		return a;

	}

	ll x;

};



constexpr int K = 16;



constexpr ll v_e[] = { 0, 765144583, 346175634, 347662323, 5655049, 184117322, 927321758, 444014759, 542573865, 237315285, 417297686, 471090892, 183023413, 660103155, 727008098, 869418286 };

constexpr ll v_o[] = { 539588932, 729548371, 700407153, 404391958, 962779130, 184117322, 927321758, 444014759, 542573865, 237315285, 417297686, 471090892, 183023413, 660103155, 727008098, 869418286 };



int main() {

	int T; scanf("%d", &T);

	for (int _t = 0; _t < T; _t++) {

		ll N; scanf("%ld", &N);

		modlong ans = 0;

		modlong x = 1;



		if (N & 1) {// odd

			for (int i = 0; i < K; i++) {

				ans += x * v_o[i];

				x *= N;

			}

		}

		else {// even

			for (int i = 0; i < K; i++) {

				ans += x * v_e[i];

				x *= N;

			}

		}

		printf("%ld\n", ans.x % mod);

	}



	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <algorithm>

#include <iomanip>

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#include <math.h>

#include <vector>

#include <string>

#include <queue>

#include <deque>

#include <list>

#include <set>

#include <unordered_set>

#include <map>

#include <unordered_map>

#include <bitset>

#include <random>

#include <complex>

#include <assert.h>



using namespace std;

typedef long long ll;

#define endl '\n'



const ll mod = 1000000007LL;



int main() {

	ios::sync_with_stdio(false);

	std::cin.tie(0);



	constexpr int K = 16;



	constexpr ll v_e[] = { 869418286, 727008098, 660103155, 183023413, 471090892, 417297686, 237315285, 542573865, 444014759, 927321758, 184117322, 5655049, 347662323, 346175634, 765144583, 0};

	constexpr ll v_o[] = { 869418286, 727008098, 660103155, 183023413, 471090892, 417297686, 237315285, 542573865, 444014759, 927321758, 184117322, 962779130, 404391958, 700407153, 729548371, 539588932 };



	ll T, N; cin >> T;

	for (int _t = 0; _t < T; _t++) {

		cin >> N;

		ll ans = v_e[0];

		if (N & 1) {// odd

			for (int i = 1; i < K; i++) {

				ans = ans * N + v_o[i];

				if(ans >= mod) ans %= mod;

			}

		}

		else {// even

			for (int i = 1; i < K; i++) {

				ans = ans * N + v_e[i];

				if (ans >= mod) ans %= mod;

			}

		}

		cout << ans << endl;

	}



	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.211108182126435x):
#include <stdio.h>



typedef long long ll;



/////////////         modの計算

const ll mod = 1000000007LL;



class modlong {

public:

	modlong() { x = 0; }

	modlong(ll num) { x = num; }

	inline operator ll() const { return x; }

	inline void operator = (ll num) { x = num; }

	inline void operator += (ll num) { x += num; }

	inline void operator *= (ll num) { x = adjust(x * num); }

	inline modlong operator * (ll num) { modlong m(adjust(x * num)); return m; }

	inline ll adjust(ll a) {

		if (a >= mod) { return a % mod; }

		return a;

	}

	ll x;

};



constexpr int K = 16;



constexpr ll v_e[] = { 0, 765144583, 346175634, 347662323, 5655049, 184117322, 927321758, 444014759, 542573865, 237315285, 417297686, 471090892, 183023413, 660103155, 727008098, 869418286 };

constexpr ll v_o[] = { 539588932, 729548371, 700407153, 404391958, 962779130, 184117322, 927321758, 444014759, 542573865, 237315285, 417297686, 471090892, 183023413, 660103155, 727008098, 869418286 };



int main() {

	int T; scanf("%d", &T);

	for (int _t = 0; _t < T; _t++) {

		ll N; scanf("%ld", &N);

		modlong ans = 0;

		modlong x = 1;



		if (N & 1) {// odd

			for (int i = 0; i < K; i++) {

				ans += x * v_o[i];

				x *= N;

			}

		}

		else {// even

			for (int i = 0; i < K; i++) {

				ans += x * v_e[i];

				x *= N;

			}

		}

		printf("%ld\n", ans.x % mod);

	}



	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <algorithm>

#include <iomanip>

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#include <math.h>

#include <vector>

#include <string>

#include <queue>

#include <deque>

#include <list>

#include <set>

#include <unordered_set>

#include <map>

#include <unordered_map>

#include <bitset>

#include <random>

#include <complex>

#include <assert.h>



using namespace std;

typedef long long ll;

#define endl '\n'



/////////////         modの計算



#define MOD_IS_PRIME

constexpr ll mod = 1000000007LL;



int main() {

	ios::sync_with_stdio(false);

	std::cin.tie(0);



	constexpr int K = 16;



	vector<ll> v_e = { 0, 765144583, 346175634, 347662323, 5655049, 184117322, 927321758, 444014759, 542573865, 237315285, 417297686, 471090892, 183023413, 660103155, 727008098, 869418286 };

	vector<ll> v_o = { 539588932, 729548371, 700407153, 404391958, 962779130, 184117322, 927321758, 444014759, 542573865, 237315285, 417297686, 471090892, 183023413, 660103155, 727008098, 869418286 };



	int T; cin >> T;

	for (int _t = 0; _t < T; _t++) {

		ll N; cin >> N;

		if (N % 2 == 0) {// even

			ll ans = 0;

			ll x = 1;

			for (int i = 0; i < K; i++) {

				ans += (x * v_e[i]) % mod;

				x = (x * N) % mod;

			}

			cout << ans % mod << endl;

		}

		else {// odd

			ll ans = 0;

			ll x = 1;

			for (int i = 0; i < K; i++) {

				ans += (x * v_o[i]) % mod;

				x = (x * N) % mod;

			}

			cout << ans % mod << endl;

		}

	}



	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.272290351025091x):
#include <stdio.h>



typedef long long ll;



/////////////         modの計算

constexpr ll mod = 1000000007;



class modlong {

public:

	modlong(ll num) { x = num; }

	inline operator ll() const { return x; }

	inline void operator = (ll num) { x = num; }

	inline void operator += (ll num) { x += num; }

	inline void operator *= (ll num) { x = adjust(x * num); }

	inline modlong operator * (ll num) { modlong m(adjust(x * num)); return m; }

	inline ll adjust(ll a) {

		if (a >= mod) { return a % mod; }

		return a;

	}

	ll x;

};



constexpr int K = 16;



constexpr ll v_e[] = { 0, 765144583, 346175634, 347662323, 5655049, 184117322, 927321758, 444014759, 542573865, 237315285, 417297686, 471090892, 183023413, 660103155, 727008098, 869418286 };

constexpr ll v_o[] = { 539588932, 729548371, 700407153, 404391958, 962779130, 184117322, 927321758, 444014759, 542573865, 237315285, 417297686, 471090892, 183023413, 660103155, 727008098, 869418286 };



int main() {

	int T; scanf("%d", &T);

	for (int _t = 0; _t < T; _t++) {

		ll N; scanf("%ld", &N);

		modlong ans = 0;

		modlong x = 1;



		if (N & 1) {// odd

			for (int i = 0; i < K; i++) {

				ans += x * v_o[i];

				x *= N;

			}

		}

		else {// even

			for (int i = 0; i < K; i++) {

				ans += x * v_e[i];

				x *= N;

			}

		}

		printf("%ld\n", ans.x % mod);

	}



	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <algorithm>

#include <iomanip>

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#include <math.h>

#include <vector>

#include <string>

#include <queue>

#include <deque>

#include <list>

#include <set>

#include <unordered_set>

#include <map>

#include <unordered_map>

#include <bitset>

#include <random>

#include <complex>

#include <assert.h>



using namespace std;

typedef long long ll;

#define endl '\n'



/////////////         modの計算



#define MOD_IS_PRIME

constexpr ll mod = 1000000007LL;



int main() {

	ios::sync_with_stdio(false);

	std::cin.tie(0);



	constexpr int K = 16;



	vector<ll> v_e = { 0, 765144583, 346175634, 347662323, 5655049, 184117322, 927321758, 444014759, 542573865, 237315285, 417297686, 471090892, 183023413, 660103155, 727008098, 869418286 };

	vector<ll> v_o = { 539588932, 729548371, 700407153, 404391958, 962779130, 184117322, 927321758, 444014759, 542573865, 237315285, 417297686, 471090892, 183023413, 660103155, 727008098, 869418286 };



	int T; cin >> T;

	for (int _t = 0; _t < T; _t++) {

		ll N; cin >> N;

		if (N % 2 == 0) {// even

			ll ans = 0;

			ll x = 1;

			for (int i = 0; i < K; i++) {

				ans += x * v_e[i];

				x *= N;

				if (ans >= mod) { ans %= mod; }

				if (x >= mod) { x %= mod; }

			}

			cout << ans << endl;

		}

		else {// odd

			ll ans = 0;

			ll x = 1;

			for (int i = 0; i < K; i++) {

				ans += x * v_o[i];

				x *= N;

				if (ans >= mod) { ans %= mod; }

				if (x >= mod) { x %= mod; }

			}

			cout << ans << endl;

		}

	}



	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.276685812599226x):
#include <stdio.h>



typedef long long ll;



/////////////         modの計算

constexpr ll mod = 1000000007;



class modlong {

public:

	modlong(ll num) { x = num; }

	inline operator ll() const { return x; }

	inline void operator = (ll num) { x = num; }

	inline void operator += (ll num) { x += num; }

	inline void operator *= (ll num) { x = adjust(x * num); }

	inline modlong operator * (ll num) { modlong m(adjust(x * num)); return m; }

	inline ll adjust(ll a) {

		if (a >= mod) { return a % mod; }

		return a;

	}

	ll x;

};



constexpr int K = 16;



constexpr ll v_e[] = { 0, 765144583, 346175634, 347662323, 5655049, 184117322, 927321758, 444014759, 542573865, 237315285, 417297686, 471090892, 183023413, 660103155, 727008098, 869418286 };

constexpr ll v_o[] = { 539588932, 729548371, 700407153, 404391958, 962779130, 184117322, 927321758, 444014759, 542573865, 237315285, 417297686, 471090892, 183023413, 660103155, 727008098, 869418286 };



int main() {

	int T; scanf("%d", &T);

	for (int _t = 0; _t < T; _t++) {

		ll N; scanf("%ld", &N);

		modlong ans = 0;

		modlong x = 1;



		if (N & 1) {// odd

			for (int i = 0; i < K; i++) {

				ans += x * v_o[i];

				x *= N;

			}

		}

		else {// even

			for (int i = 0; i < K; i++) {

				ans += x * v_e[i];

				x *= N;

			}

		}

		printf("%ld\n", ans.x % mod);

	}



	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <algorithm>

#include <iomanip>

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#include <math.h>

#include <vector>

#include <string>

#include <queue>

#include <deque>

#include <list>

#include <set>

#include <unordered_set>

#include <map>

#include <unordered_map>

#include <bitset>

#include <random>

#include <complex>

#include <assert.h>



using namespace std;

typedef long long ll;



constexpr ll mod = 1000000007;

constexpr ll v[] = { 0, 765144583, 346175634, 347662323, 5655049, 184117322, 927321758, 444014759, 542573865, 237315285, 417297686, 471090892, 183023413, 660103155, 727008098, 539588932, 729548371, 700407153, 404391958, 962779130, 184117322, 927321758, 444014759, 542573865, 237315285, 417297686, 471090892, 183023413, 660103155, 727008098 };



int main() {

	int N, T; scanf("%d", &T);

	for (int _t = 0; _t < T; _t++) {

		scanf("%d", &N);

		ll ans = 869418286;

		if (N & 1) {// odd

			for (int i = 14, j = 29; i >= 0; i--, j--) {

				ans = (ans * N + v[j]) % mod;

			}

		}

		else {// even

			for (int i = 14; i >= 0; i--) {

				ans = (ans * N + v[i]) % mod;

			}

		}

		printf("%d\n", ans);

	}



	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.087767032865756x):
#include <stdio.h>



typedef long long ll;



/////////////         modの計算

constexpr ll mod = 1000000007;



class modlong {

public:

	modlong(ll num) { x = num; }

	inline operator ll() const { return x; }

	inline void operator = (ll num) { x = num; }

	inline void operator += (ll num) { x += num; }

	inline void operator *= (ll num) { x = adjust(x * num); }

	inline modlong operator * (ll num) { modlong m(adjust(x * num)); return m; }

	inline ll adjust(ll a) {

		if (a >= mod) { return a % mod; }

		return a;

	}

	ll x;

};



constexpr int K = 16;



constexpr ll v_e[] = { 0, 765144583, 346175634, 347662323, 5655049, 184117322, 927321758, 444014759, 542573865, 237315285, 417297686, 471090892, 183023413, 660103155, 727008098, 869418286 };

constexpr ll v_o[] = { 539588932, 729548371, 700407153, 404391958, 962779130, 184117322, 927321758, 444014759, 542573865, 237315285, 417297686, 471090892, 183023413, 660103155, 727008098, 869418286 };



int main() {

	int T; scanf("%d", &T);

	for (int _t = 0; _t < T; _t++) {

		ll N; scanf("%ld", &N);

		modlong ans = 0;

		modlong x = 1;



		if (N & 1) {// odd

			for (int i = 0; i < K; i++) {

				ans += x * v_o[i];

				x *= N;

			}

		}

		else {// even

			for (int i = 0; i < K; i++) {

				ans += x * v_e[i];

				x *= N;

			}

		}

		printf("%ld\n", ans.x % mod);

	}



	return 0;

}