You are given an integer N. Snuke selects integers s1, s2, n1, n2, u1, u2, k1, k2, e1, and e2 such that specific conditions are met. For each choice, compute (s2 − s1)(n2 − n1)(u2 − u1)(k2 - k1)(e2 - e1), and find the sum of all computed values modulo (10^9 +7). Solve this for each of the T test cases. Constraints: All input values are integers, 1 ≤ T ≤ 100, 1 ≤ N ≤ 10^9. Input format: T followed by T cases, each with N. Output format: T lines, each containing the answer for the corresponding test case.

# Buggy version:
#!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):
    ans = 0
    if n & 1:
        Y = [37033746750,-19102088250,-75258447165,+8922649446,+41082466425,+12030593120,-2592429840,-1880967088,-281252400,+27251510,+15690675,+2549638,+225225,+11620,+330,+4]
    else:
        Y = [0,         -98703360000,-108248279040,+4240221696,+40869628800,+12030593120,-2592429840,-1880967088,-281252400,+27251510,+15690675,+2549638,+225225,+11620,+330,+4]

    x = 1
    for i, y in enumerate(Y):
        ans = (ans + x*(y%mod) % mod) % mod
        #print(i, y, x)
        x = x*n%mod
        #ans = ans + x * y
    ans = ans * pow(167382319104000, mod-2, mod) % mod
    #ans /= 167382319104000
    return ans

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

    if N == 4: raise 1

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

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

if __name__ == "__main__":
    resolve()


# Fixed version:
#!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):
    ans = 0
    if n & 1:
        Y = [37033746750,-19102088250,-75258447165,+8922649446,+41082466425,+12030593120,-2592429840,-1880967088,-281252400,+27251510,+15690675,+2549638,+225225,+11620,+330,+4]
    else:
        Y = [0,         -98703360000,-108248279040,+4240221696,+40869628800,+12030593120,-2592429840,-1880967088,-281252400,+27251510,+15690675,+2549638,+225225,+11620,+330,+4]

    x = 1
    for i, y in enumerate(Y):
        ans = (ans + x*(y%mod) % mod) % mod
        x = x*n%mod
    ans = ans * pow(167382319104000, mod-2, mod) % mod
    return ans

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()

# Buggy version:
import numpy as np

MOD = 10 ** 9 + 7

l_matrix = np.zeros((32, 32), np.uint64)
for i in range(16):
    l_matrix[i+16][i] = 1
    l_matrix[i][i+16] = 1
for i in range(15):
    l_matrix[i+1][i] = 1
for i in range(5, 15):
    l_matrix[i+1][i+16] = 1
    
doubling = [l_matrix] #doubling[i] = (l_matrix) ** (2 ** i) % MOD
for _ in range(30):
    doubling.append(doubling[-1] @ doubling[-1] % MOD)

T = int(input())
for _ in range(T):
    N = int(input())
    N += 10
    dp = np.zeros(32, np.uint64)
    dp[0] = 1
    for i, c in enumerate(reversed(format(N, 'b'))):
        if c == '1':
            dp = doubling[i] @ dp
            dp %= MOD
    print((dp[15] + dp[31]) % MOD)
    #print(dp)


# Fixed version:
import numpy as np

MOD = 10 ** 9 + 7

l_matrix = np.zeros((32, 32), np.uint64)
for i in range(16):
    l_matrix[i+16][i] = 1
    l_matrix[i][i+16] = 1
for i in range(15):
    l_matrix[i+1][i] = 1
for i in range(5, 15):
    l_matrix[i+1][i+16] = 1
    
doubling = [l_matrix] #doubling[i] = (l_matrix) ** (2 ** i) % MOD
for _ in range(30):
    doubling.append(doubling[-1] @ doubling[-1] % MOD)

T = int(input())
for _ in range(T):
    N = int(input())
    N += 10
    dp = np.zeros(32, np.uint64)
    dp[0] = 1
    for i, c in enumerate(reversed(format(N, 'b'))):
        if c == '1':
            dp = doubling[i] @ dp
            dp %= MOD
    print(int((dp[15] + dp[31]) % MOD))
    #print(dp)