Routes Across a Grid
On an H×W grid you walk from the top-left cell to the bottom-right cell moving only right or down. How many routes exist, modulo 109+7?
Input: one line with two integers H and W.
Output: C(H+W−2, H−1) mod 109+7.
Constraints:
- 1 ≤ H, W ≤ 106
Sample Tests
Input 1
2 3
Output 1
3
Input 2
1 1
Output 2
1
Discussion (opens after you solve — no spoilers before)
No comments yet.