A picker robot stands on the top-left cell of a warehouse grid that has H rows and W columns of cells. Each step it moves either one cell to the right (east) or one cell down (south). Count the number of distinct routes it can take to reach the bottom-right cell. Report the count modulo 1000000007.
A single line with two integers H and W.
A single integer: the number of monotone routes, modulo 1000000007.
Example 1
Input
2 3
Expected
3
Explanation
On a 2x3 grid there are C(3,1)=3 monotone routes to the far corner.
Example 2
Input
1 1
Expected
1
Explanation
The start already is the destination, so there is exactly one (empty) route.
Ready to solve this?
Sign in to open the editor, run your code against the sample tests, and submit against the full test suite.
Sign in to solve →