Under construction

Still being built. Things may change

Random Walk That Never Goes Negative

Time limit2sMemory limit64 MB

Summary
Count length-2N walks from 0 back to 0 with steps of plus or minus 1 that never drop below 0, modulo 1,000,000,007.
Level

Medium5 of 10

Topics
Combinatorics, Math
Solved
No attempts yet

Problem

Seonyeong stands at the origin of a very long line. In one move she can step one square to the left or one square to the right.

The number of random walks that use 2N2N moves and end at the starting square is (2NN)\binom{2N}{N}. Coming back to the start forces the number of left moves to equal the number of right moves, so the walk makes NN moves right and NN moves left, and only their order is free.

In that version Seonyeong can stand on a negative coordinate. Write a program that counts the walks once the extra rule "never move to a negative coordinate" is added. For N=1N = 1 she can walk 0→1→00 \to 1 \to 0, but she cannot walk 0→−1→00 \to -1 \to 0.

Input

The first line contains the number of test cases TT (T≤1,000T \le 1{,}000). Each of the next TT lines contains the value NN (1≤N≤1,000,0001 \le N \le 1{,}000{,}000) of one test case.

Output

For each test case, print the number of random walks that return to the starting square without ever visiting a negative coordinate, modulo 1,000,000,007. Print one answer per line.

Examples2

  1. Example 1

    Input
    3
    1
    3
    6
    
    Expected output
    1
    5
    132
    
  2. Example 2

    Input
    1
    1
    
    Expected output
    1