Chef is good at making pancakes. Generally he gets requests to serve N pancakes at once.
He serves them in the form of a stack.
A pancake can be treated as a circular disk with some radius.
Chef needs to take care that when he places a pancake on the top of the stack the radius of the pancake should not exceed the radius of the largest pancake in the stack by more than 1. 
Additionally all radii should be positive integers, and the bottom most pancake should have its radius as 1.
Chef wants you to find out in how many ways can he create a stack containing N pancakes.
Input
First line of the input contains T (T <= 1000) denoting the number of test cases.
T lines follow each containing a single integer N (1 <= N <= 1000) denoting the size of the required stack.
Output
For each case the output should be a single integer representing the number of ways a stack of size N can be created. As the answer can be large print it modulo 1000000007.
Example
Input
2
1
2
Output
1
2
#!/usr/bin/env python

BELL = []
for i in range(1000): BELL.append([0] * 1000)
BELL[0][0] = 1

for r in range(1, 1000):
 BELL[r][0] = BELL[r-1][r-1]
 for c in range(1, r + 1):
  BELL[r][c] = (BELL[r-1][c-1] + BELL[r][c-1]) % 1000000007

def main():
 T = int(input())
 for t in range(T):
  N = int(input())
  print(BELL[N-1][N-1])

main()


#!/usr/bin/env python

BELL = []
for i in range(1000): BELL.append([0] * 1000)
BELL[0][0] = 1

for r in range(1, 1000):
 BELL[r][0] = BELL[r-1][r-1]
 for c in range(1, r + 1):
  BELL[r][c] = (BELL[r-1][c-1] + BELL[r][c-1]) % 1000000007

def main():
 T = int(input())
 for t in range(T):
  N = int(input())
  print(BELL[N-1][N-1])

main()

