#t315. 移动路线

移动路线

Number of Paths

Problem Background

Special for beginners, ^_^

Problem Description

On table X there is an mm-row, nn-column grid matrix. Each cell is represented by coordinates: the row coordinate increases from bottom to top, and the column coordinate increases from left to right. The bottom-left cell has coordinates (1,1)(1,1), so the top-right cell has coordinates (m,n)(m,n).

Xiaoming, a naughty child, once caught an ant and accidentally injured its right foot, so the ant can only move up or to the right. Xiaoming places the ant in the bottom-left cell, and it moves from the bottom-left cell to the top-right cell, one cell per step. The ant always stays within the grid. Count the number of different paths.

For a 1×11 \times 1 grid, the ant does not move, so the number of paths is 1.

For a 1×21 \times 2 (or 2×12 \times 1) grid, the ant only needs one move to the right (or up), so the number of paths is also 1.

...

For a 2×32 \times 3 grid, as shown below:

(2,1) (2,2) (2,3)
(1,1) (1,2) (1,3)

The ant has 3 paths:

Path 1: (1,1) → (1,2) → (1,3) → (2,3)

Path 2: (1,1) → (1,2) → (2,2) → (2,3)

Path 3: (1,1) → (2,1) → (2,2) → (2,3)

Input Format

One line containing two integers mm and n(0<m+n≤20)n (0 < m + n \le 20), representing the number of rows and columns of the grid, separated by a space.

Output Format

One line containing the number of different paths.

Sample Input

2 3

Sample Output

3

Constraints

1 second, 1024 KiB for each test case.