#C2794. Unique Paths in a Grid

    ID: 46149 Type: Default 1000ms 256MiB

Unique Paths in a Grid

Unique Paths in a Grid

Given an M x N grid, determine the number of unique paths from the top-left corner to the bottom-right corner, if you can only move either right or down at any step. The number of paths is given by the combinatorial formula: $$\text{Paths} = \binom{M+N-2}{M-1}$$. You can also solve this problem using dynamic programming by summing the paths from the top and left cells.

inputFormat

The input consists of one line containing two integers M and N separated by a space, where M represents the number of rows and N represents the number of columns.

outputFormat

Output a single integer denoting the number of unique paths from the top-left corner to the bottom-right corner of the grid.

## sample
3 3
6

</p>