Master Oogway has forseen that a panda named Po will be the dragon warrior, and the master of Chi. But he did not tell anyone about the spell that would make him the master of Chi, and has left Po confused. Now Po has to defeat Kai, who is the super villian, the strongest of them all. Po needs to master Chi, and he finds a spell which unlocks his powerful Chi. But the spell is rather strange. It asks Po to calculate the factorial of a number! Po is very good at mathematics, and thinks that this is very easy. So he leaves the spell, thinking it's a hoax. But little does he know that this can give him the ultimate power of Chi. Help Po by solving the spell and proving that it's not a hoax.

-----Input-----
First line of input contains an integer T denoting the number of test cases.
The next T lines contain an integer N.

-----Output-----
For each test case, print a single line containing the solution to the spell which is equal to factorial of N, i.e. N!. Since the output could be large, output it modulo 1589540031(Grand Master Oogway's current age).

-----Constraints-----
- 1 ≤ T ≤ 100000
- 1 ≤ N ≤ 100000

-----Example-----
Input:
4
1
2
3
4

Output:
1
2
6
24

Source: codechef | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
arr = []
arr.append(1)
_ = 1
while _ <= 100002:
	arr.append(_ * arr[_ - 1] % 1589540031)
	_ += 1
for _ in range(int(input())):
	print(arr[int(input())])


T = int(input())
a = []
a.append(1)
for j in range(10 ** 5 + 1):
	a.append(a[j] * (j + 1) % 1589540031)
for i in range(T):
	N = int(input())
	print(a[N])


a = []
a.append(1)
for i in range(1, 100001):
	a.append(a[-1] * i % 1589540031)
t = int(input())
for i in range(t):
	n = int(input())
	print(a[n])


t = eval(input())
li = [0] * 100001
li[1] = 1
for j in range(2, 100001):
	li[j] = li[j - 1] * j % 1589540031
for x in range(t):
	n = eval(input())
	print(li[n])


facts = []
last = 1
for i in range(1, 100001):
	last = last * i % 1589540031
	facts.append(last)
for x in range(eval(input())):
	print(facts[eval(input()) - 1])