Home Web Board ProblemSet Standing Status Statistics
long long输出请使用 %lld服务器的python版本为3.4
Problem A: Walking on the Grid

Problem A: Walking on the Grid

Time Limit: 1 Sec  Memory Limit: 32 MB
Submit: 144  Solved: 57
[Submit][Status][Web Board]


Biving lives in Grid Kingdom, which is a special country as all its cities lie in a grid of size W*H.

Biving’s home locates in grid(1, 1) and she wants to go to grid(W, H) as soon as possible. In each step, she can walk from grid(I, J) to grid(I+1, J) or grid(I, J+1), but she can never walk out of the grid.

Here comes the question, how many path Biving can choose to achieve her goal. Two path Pi and Pj are treat as different if there exist some step Pi going to grid(x, y) but Pj don’t.


The input contains multiple test cases (<= 100).

       The first line of each test case contains two integer W, H(1<=W<=30, 1<=H<=30).


For each case, output the path’s number modulo 1,000,000,007 in a single line.

Sample Input

1 1
2 2
3 3

Sample Output



[Submit][Status][Web Board]