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 PyPy3 (7.3.0) (judge verdict: Accepted)

#!python3

import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())
from functools import lru_cache

mod = 10 **9 + 7


@lru_cache(100)
def calc(n):
    m = (n-5) // 2

    #return (1+m)*(2+m)*(3+m)*(4+m)*(5+m)*(1025024*m**10+3003*(-4+n)*(-3+n)*(-2+n)*(-1+n)*n*(1+n)*(2+n)*(3+n)*(4+n)*(5+n)-549120*m**9*(-1+10*n)+42240*m**8*(-398+45*n*(-1+7*n))-369600*m**7*(3+2*(-2+n)*n*(49+26*n))+2688*m**6*(33529+75*n*(-33-679*n+91*n**3))-336*m**5*(88065+2*n*(426107+7*n*(-6675+13*n*(-2420+9*n*(5+22*n)))))+560*m**4*(-291598+n*(216249+7*n*(95465+26*n*(-495+n*(-980+11*n*(3+5*n))))))-30*m**3*(-3080960+n*(-10447602+7*n*(854525+13*n*(93170+n*(-15295+22*n*(-714+5*n*(7+6*n)))))))+2*m**2*(28412712+25*n*(-3433650+n*(-4123841+13*n*(189882+n*(142177+22*n*(-1344+n*(-791+27*n*(2+n))))))))-m*(30149280+n*(31294296+n*(-93275400+13*n*(-3808420+n*(2988195+11*n*(111678+25*n*(-1302+n*(-456+n*(45+14*n))))))))))/1307674368000
    return (
        (1+m)*(2+m)*(3+m)%mod*(4+m)*(5+m)%mod*(
            1025024*pow(m,10,mod)+3003*(-4+n)%mod*(-3+n)*(-2+n)%mod*(-1+n)*n*(1+n)%mod*(2+n)*(3+n)%mod*(4+n)*(5+n)%mod
            -549120*pow(m,9,mod)*(-1+10*n)%mod
            +42240*pow(m,8,mod)*(-398+45*n*(-1+7*n))%mod
            -369600*pow(m,7,mod)*(3+2*(-2+n)*n*(49+26*n)%mod)%mod
            +2688*pow(m,6,mod)*(33529+75*n*(-33-679*n+91*n**3)%mod)%mod
            -336*pow(m,5,mod)*(88065+2*n*(426107+7*n*(-6675+13*n*(-2420+9*n*(5+22*n)%mod))%mod))%mod
            +560*pow(m,4,mod)*(-291598+n*(216249+7*n*(95465+26*n*(-495+n*(-980+11*n*(3+5*n))%mod))%mod))%mod
            -30*pow(m,3,mod)*(-3080960+n*(-10447602+7*n*(854525+13*n*(93170+n*(-15295+22*n*(-714+5*n*(7+6*n)%mod))%mod))%mod))%mod
            +2*pow(m,2,mod)*(28412712+25*n*(-3433650+n*(-4123841+13*n*(189882+n*(142177+22*n*(-1344+n*(-791+27*n*(2+n))%mod))%mod))%mod))%mod
            -m*(30149280+n*(31294296+n*(-93275400+13*n*(-3808420+n*(2988195+11*n*(111678+25*n*(-1302+n*(-456+n*(45+14*n)%mod))%mod))%mod))%mod))%mod
        )%mod*pow(1307674368000%mod, mod-2, mod)%mod
    )

def resolve():
    it = map(int, sys.stdin.read().split())
    N = next(it)

    ans = [0] * N
    for i in range(N):
        n = next(it)
        ans[i] = calc(n)

    print(*ans, sep="\n")

if __name__ == "__main__":
    resolve()