文理学院程序设计在线练习


Walking on the Grid

Time Limit: 1 Second(s)    Memory Limit: 32 MB

Total Submission(s): 64   Accepted Submission(s): 28
Problem Description

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.

Input

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).

Output

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
1
2
6
Source

2013绍兴市赛