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

#!python3



import sys

iim = lambda: map(int, sys.stdin.readline().rstrip().split())



mod = 10 **9 + 7





def calc(n):

    ans = 0

    if n & 1:

        Y = [33746491, 897911890, 741553367, 922649390, 82466138, 30593036, 407570181, 119032926, 718747607, 27251510, 15690675, 2549638, 225225, 11620, 330, 4]

    else:

        Y = [0,       296640693, 751721723, 240221668, 869628520, 30593036, 407570181, 119032926, 718747607, 27251510, 15690675, 2549638, 225225, 11620, 330, 4]



    x = 1

    for y in Y:

        ans = (ans + x*y%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()

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

#!python3
import sys

iim = lambda: map(int, sys.stdin.readline().rstrip().split())
mod = 10**9 + 7


def calc(n):
    ans = 0
    if n & 1:
        Y = [
            33746491,
            897911890,
            741553367,
            922649390,
            82466138,
            30593036,
            407570181,
            119032926,
            718747607,
            27251510,
            15690675,
            2549638,
            225225,
            11620,
            330,
            4,
        ]
    else:
        Y = [
            0,
            296640693,
            751721723,
            240221668,
            869628520,
            30593036,
            407570181,
            119032926,
            718747607,
            27251510,
            15690675,
            2549638,
            225225,
            11620,
            330,
            4,
        ]
    x = 1
    for y in Y:
        ans = (ans + x * y % 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()

-from functools import lru_cache - -@lru_cache(100) -            37033746750, -            -19102088250, -            -75258447165, -            +8922649446, -            +41082466425, -            +12030593120, -            -2592429840, -            -1880967088, -            -281252400, -            +27251510, -            +15690675, -            +2549638, -            +225225, -            +11620, -            +330, -            +4, +            33746491, +            897911890, +            741553367, +            922649390, +            82466138, +            30593036, +            407570181, +            119032926, +            718747607, +            27251510, +            15690675, +            2549638, +            225225, +            11620, +            330, +            4, -            -98703360000, -            -108248279040, -            +4240221696, -            +40869628800, -            +12030593120, -            -2592429840, -            -1880967088, -            -281252400, -            +27251510, -            +15690675, -            +2549638, -            +225225, -            +11620, -            +330, -            +4, +            296640693, +            751721723, +            240221668, +            869628520, +            30593036, +            407570181, +            119032926, +            718747607, +            27251510, +            15690675, +            2549638, +            225225, +            11620, +            330, +            4, -    for i, y in enumerate(Y): -        ans = (ans + x * (y % mod) % mod) % mod +    for y in Y: +        ans = (ans + x * y % mod) % mod