ADV04B - Upper Right King (Easy)

no tags 

There is a king in the lower left corner of the n × n checkmate board. The king can move one step right, one step up or one step up-right. How many ways are there for him to reach the upper right corner of the board?

Input

The first line of input contains number T - the amount of test cases. Next T lines consist of single integer n - the size of the board.

Constraints

1 <= T <= 1000
1 <= n <= 1000

Output

For each test case output the munber of ways to reach upper right corner of n × n board modulo 1000003.

Example

Input:
2
2
3

Output:
3
13


hide comments
dhruv2212000: 2019-03-20 12:22:43

Recursive approach based on F(n,n) = F(n-1,n) + F(n,n-1) + F(n-1,n-1) would give TLE. Go for delannoy numbers :) .


Added by:Spooky
Date:2010-11-14
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:Advancement Autumn 2010, http://sevolymp.uuuq.com/, author: Alexey Shchepin