#C1159. Unique Paths in a Grid

    ID: 40922 Type: Default 1000ms 256MiB

Unique Paths in a Grid

Unique Paths in a Grid

You are given a grid of size M rows and N columns. Your task is to calculate the number of unique paths from the top-left corner to the bottom-right corner of the grid. You can only move either down or right at any step.

The answer can be computed using dynamic programming or by using the combinatorial formula: \( \binom{M+N-2}{M-1} \). Challenge yourself to implement an efficient solution that reads input from standard input (stdin) and prints the result to standard output (stdout).

inputFormat

The input consists of a single line containing two integers M and N separated by spaces. M represents the number of rows and N represents the number of columns in the grid.

Example: 3 7

outputFormat

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

## sample
3 7
28