#C11045. Unique Paths in a Grid

    ID: 40318 Type: Default 1000ms 256MiB

Unique Paths in a Grid

Unique Paths in a Grid

Given a grid with m rows and n columns, calculate the number of unique paths from the top-left corner to the bottom-right corner. The robot can only move either down or right at any point in time.

The problem can be mathematically formulated as computing the binomial coefficient: $$ \text{UniquePaths}(m,n)=\binom{m+n-2}{m-1}=\binom{m+n-2}{n-1} $$ although a dynamic programming approach can be used as well.

Note: You are required to read the input from stdin and output the result to stdout.

inputFormat

The input consists of two space-separated integers m and n representing the dimensions of the grid.

outputFormat

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

## sample
3 7
28