Random Walks#6575

Random Walks

1 second
64 megabytes
Medium

"Thorfun Company Limited" aka "thorfun.com", a social network for blogger, writer and reader, founded by four new graduated. One of them is passionate about computational problems. One day he found something very interesting because it is a solution of various problems and "Random Walks" is one of them. Given a one dimensional line and you stand at the original point (position 0). At each step you can walk either left or right for unit length.

First, let us have a look at a basic version of the problem. You can walk whatever you want for steps but, you must end at the original point. How many different paths can you walk? The solution is very simple. You start and end at the same point, it means that you must take the same number of left and right step. Choosing steps to the right and steps to the left from steps.

"Random Walks" problem is similar to the basic problem. However, during the walks you must not walk into negative integers. For example, if N = 1 you can walk on the path 0 \to 1 \to 0 but you can't walk on path 0 \to -1 \to 0. Your task is to write a program to compute the number of paths that follow the above rules. In addition, the result may be very large. So, print the result modulo by (Prime number).

Input

First line of input is a number of test cases T \le 1000.

Each test case is a line containing an integer (1 \le N \le 1000000).

Output

For each test case, display an integer indicating the number of paths that you can walk modulo by .

Examples

Example 1

Loading
Loading