Problem:
Score : 600 points

Problem Statement

Given is an integer N. Snuke will choose integers s_1, s_2, n_1, n_2, u_1, u_2, k_1, k_2, e_1, and e_2 so that all of the following six conditions will be satisfied:

0 \leq s_1 < s_2

0 \leq n_1 < n_2

0 \leq u_1 < u_2

0 \leq k_1 < k_2

0 \leq e_1 < e_2

s_1 + s_2 + n_1 + n_2 + u_1 + u_2 + k_1 + k_2 + e_1 + e_2 \leq N

For every possible choice (s_1,s_2,n_1,n_2,u_1,u_2,k_1,k_2,e_1,e_2), compute (s_2 − s_1)(n_2 − n_1)(u_2 − u_1)(k_2 - k_1)(e_2 - e_1), and find the sum of all computed values, modulo (10^{9} +7).

Solve this problem for each of the T test cases given.

Constraints

All values in input are integers.

1 \leq T \leq 100

1 \leq N \leq 10^{9}

Input

Input is given from Standard Input in the following format:

T
\mathrm{case}_1
\vdots
\mathrm{case}_T

Each case is given in the following format:

N

Output

Print T lines. The i-th line should contain the answer to the i-th test case.

Sample Input 1

4
4
6
10
1000000000

Sample Output 1

0
11
4598
257255556

When N=4, there is no possible choice (s_1,s_2,n_1,n_2,u_1,u_2,k_1,k_2,e_1,e_2). Thus, the answer is 0.

When N=6, there are six possible choices (s_1,s_2,n_1,n_2,u_1,u_2,k_1,k_2,e_1,e_2) as follows:

(0,1,0,1,0,1,0,1,0,1)

(0,2,0,1,0,1,0,1,0,1)

(0,1,0,2,0,1,0,1,0,1)

(0,1,0,1,0,2,0,1,0,1)

(0,1,0,1,0,1,0,2,0,1)

(0,1,0,1,0,1,0,1,0,2)

We have one choice where (s_2 − s_1)(n_2 − n_1)(u_2 − u_1)(k_2 - k_1)(e_2 - e_1) is 1 and five choices where (s_2 − s_1)(n_2 − n_1)(u_2 − u_1)(k_2 - k_1)(e_2 - e_1) is 2, so the answer is 11.

Be sure to find the sum modulo (10^{9} +7).

Solution in C++ (GCC 9.2.1) (judge verdict: Accepted)

#include <bits/stdc++.h>
using namespace std;

const int MOD = 1000000007;
const int MAXM = 105;
const int MAXS = 20;

long long modpow(long long x, long long p){
	if(p == 0)return 1;
	if(p % 2 == 1)return x * modpow(x, p - 1) % MOD;
	
	long long r = modpow(x, p / 2);
	return r * r % MOD;
}
long long modinv(long long x){
	return modpow(x, MOD - 2);
}

long long inv[MAXM];

long long C(int n, int r){
	long long ret = 1;
	for(int i = 0; i < r; i++)
		ret = ret * (n - i) % MOD * inv[i + 1] % MOD;
	return ret;
}

int t, n;
long long dp[MAXS][MAXS][MAXS];

int main(){
	for(int i = 1; i < MAXM; i++)
		inv[i] = modinv(i);
	
	scanf("%d", &t);
	while(t--){
		scanf("%d", &n);
		
		for(int a = 0; a <= 5; a++)
		for(int b = 0; b <= 16; b++)
		for(int c = 0; c <= min(b, 5); c++){
			if(a > 0){
				dp[a][b][c] = (dp[a - 1][b + 1][c] - dp[a - 1][b][c] + MOD) % MOD;
			}else{
				if(c == 0){
					dp[a][b][c] = C(n + b - 1, b - 1);
				}else if(b == c){
					if(n % 2 == 0)dp[a][b][c] = C(n / 2 + b - 1, b - 1);
					else dp[a][b][c] = 0;
				}else{
					dp[a][b][c] = (dp[a][b][c - 1] + dp[a][b - 1][c]) * inv[2] % MOD;
				}
			}
		}
		
		printf("%lld\n", dp[5][11][5]);
	}
	return 0;
}