#K88667. Unique Paths in a Grid

    ID: 37360 Type: Default 1000ms 256MiB

Unique Paths in a Grid

Unique Paths in a Grid

You are given a grid of size n × m. A robot starts at the top-left corner and its goal is to reach the bottom-right corner of the grid. The robot can only move either right or down at any step.

Your task is to calculate the number of unique paths the robot can take to reach the destination. Since the number can be very large, output the result modulo $$10^9+7$$.

The number of unique paths can be computed using dynamic programming or combinatorics. In fact, by using combinatorial reasoning, the number of unique paths is given by:

$$ \text{Unique Paths} = \binom{n+m-2}{n-1} $$

Implement the solution accordingly so that it works for any valid grid dimensions.

inputFormat

The input consists of two space-separated integers n and m, representing the number of rows and columns of the grid respectively.

outputFormat

Output a single integer representing the number of unique paths from the top-left to the bottom-right corner of the grid, modulo $$10^9+7$$.

## sample
3 2
3

</p>