from math import *
F = [0] * (10 ** 6 + 1)
def init():
F[0] = 1
for i in range(1 , 10 ** 6 + 1):
F[i] = F[i - 1] * i
F[i] %= (10 ** 9 + 7)
if __name__ == '__main__':
init()
t = int(input())
for i in range(t):
n = int(input())
print(F[n])
ZnJvbSBtYXRoIGltcG9ydCAqCkYgPSBbMF0gKiAoMTAgKiogNiArIDEpCmRlZiBpbml0KCk6CiAgICBGWzBdID0gMQogICAgZm9yIGkgaW4gcmFuZ2UoMSAsIDEwICoqIDYgKyAxKToKICAgICAgICBGW2ldID0gRltpIC0gMV0gKiBpIAogICAgICAgIEZbaV0gJT0gKDEwICoqIDkgKyA3KQogICAgCgppZiBfX25hbWVfXyA9PSAnX19tYWluX18nOgogICAgaW5pdCgpCiAgICB0ID0gaW50KGlucHV0KCkpCiAgICBmb3IgaSBpbiByYW5nZSh0KToKICAgICAgICBuID0gaW50KGlucHV0KCkpCiAgICAgICAgcHJpbnQoRltuXSkKICAgIAo=