#!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)*(4+m)*(5+m)%mod*(

            1025024*pow(m,10,mod)+3003*(-4+n)%mod*(-3+n)%mod*(-2+n)%mod*(-1+n)*n*(1+n)%mod*(2+n)%mod*(3+n)%mod*(4+n)%mod*(5+n)%mod

            -549120*pow(m,9,mod)*(-1+10*n)%mod

            +42240*pow(m,8,mod)*(-398+45*n*(-1+7*n)%mod)%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)%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)%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)%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)%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)%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()

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

#!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)
        * (4 + m)
        * (5 + m)
        % mod
        * (
            1025024 * pow(m, 10, mod)
            + 3003
            * (-4 + n)
            % mod
            * (-3 + n)
            % mod
            * (-2 + n)
            % mod
            * (-1 + n)
            * n
            * (1 + n)
            % mod
            * (2 + n)
            % mod
            * (3 + n)
            % mod
            * (4 + n)
            % mod
            * (5 + n)
            % mod
            - 549120 * pow(m, 9, mod) * (-1 + 10 * n) % mod
            + 42240 * pow(m, 8, mod) * (-398 + 45 * n * (-1 + 7 * n) % mod) % 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
                )
                % 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
                    )
                    % 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
                    )
                    % 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
                        )
                        % 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
                    )
                    % 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()

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

+        % mod -            % mod -            % mod -            % mod -            + 42240 * pow(m, 8, mod) * (-398 + 45 * n * (-1 + 7 * n) % mod) % mod +            + 42240 * pow(m, 8, mod) * (-398 + 45 * n * (-1 + 7 * n)) % mod -                    * (-6675 + 13 * n * (-2420 + 9 * n * (5 + 22 * n) % mod) % mod) +                    * (-6675 + 13 * n * (-2420 + 9 * n * (5 + 22 * n) % mod)) -                % mod -                        + 26 -                        * n -                        * (-495 + n * (-980 + 11 * n * (3 + 5 * n) % mod) % mod) -                        % mod +                        + 26 * n * (-495 + n * (-980 + 11 * n * (3 + 5 * n)) % mod) -                % mod -                            * ( -                                -15295 -                                + 22 * n * (-714 + 5 * n * (7 + 6 * n) % mod) % mod -                            ) +                            * (-15295 + 22 * n * (-714 + 5 * n * (7 + 6 * n) % mod)) -                        % mod -                % mod -                                + 22 -                                * n -                                * (-1344 + n * (-791 + 27 * n * (2 + n) % mod) % mod) -                                % mod +                                + 22 * n * (-1344 + n * (-791 + 27 * n * (2 + n)) % mod) -                        % mod -                % mod -                                    * ( -                                        -1302 -                                        + n * (-456 + n * (45 + 14 * n) % mod) % mod -                                    ) +                                    * (-1302 + n * (-456 + n * (45 + 14 * n) % mod)) -                                % mod -                        % mod -                % mod