Cry,men,not crime

Time Limit: 1000ms
Memory Limit: 32768KB
This problem will be judged on HDU. Original ID: 2621
64-bit integer IO format: %I64d      Java class name: Main

Description

Cry,men,not crime------When I was a child ever, people around me told me not to tear. When I am a man now, I said to the mirror not to regret anything.

See the figure below,please calculate how many paths are there on a grid where each step of the path consists of moving one unit to the right or one unit up, which from left-down to right-up.

It is a simple problem, isn’t it ?
If you can’t solve it, please cry, although you are a man, nobody will laugh at you, it is not crime !

Input

The input contains several test cases. Each is specified by two integers n and m, denoting the size of the rectangle. As you can observe, the number of lines of the corresponding grid is one more in each dimension. Input is terminated by n=m=0.

Output

For each test case , calculate how many paths are there on a grid where each step of the path consists of moving one unit to the right or one unit up? You may safely assume that this number fits into a 32-bit unsigned integer.

Sample Input

5 4
1 1
0 0

Sample Output

126
2

Source

Language: 
Theme: 
Share Code? 

Powered by NB231 | Current Style: .