Preparando MOJI

2-Coloring

3000ms 262144K

Description:

There is a grid with $$$n$$$ rows and $$$m$$$ columns. Every cell of the grid should be colored either blue or yellow.

A coloring of the grid is called stupid if every row has exactly one segment of blue cells and every column has exactly one segment of yellow cells.

In other words, every row must have at least one blue cell, and all blue cells in a row must be consecutive. Similarly, every column must have at least one yellow cell, and all yellow cells in a column must be consecutive.

An example of a stupid coloring.
Examples of clever colorings. The first coloring is missing a blue cell in the second row, and the second coloring has two yellow segments in the second column.

How many stupid colorings of the grid are there? Two colorings are considered different if there is some cell that is colored differently.

Input:

The only line contains two integers $$$n$$$, $$$m$$$ ($$$1\le n, m\le 2021$$$).

Output:

Output a single integer — the number of stupid colorings modulo $$$998244353$$$.

Sample Input:

2 2

Sample Output:

2

Sample Input:

4 3

Sample Output:

294

Sample Input:

2020 2021

Sample Output:

50657649

Note:

In the first test case, these are the only two stupid $$$2\times 2$$$ colorings.

Informação

Codeforces

Provedor Codeforces

Código CF1503E

Tags

combinatoricsdpmath

Submetido 0

BOUA! 0

Taxa de BOUA's 0%

Datas 09/05/2023 10:12:18

Relacionados

Nada ainda