AtCoder Regular Contest 192 (Div. 2)
E
Snuke's Kyoto Trip
AtCoder
⌀ 3142
原题
← D→
翻译中…

Problem Statement

翻译中…

You are given integers $W,H,L,R,D,U$.

翻译中…

A town of Kyoto is on the two-dimensional plane.

翻译中…

In the town, there is exactly one block at each lattice point $(x,y)$ that satisfies all of the following conditions. There are no blocks at any other points.

翻译中…
  • $0\leq x\leq W$
  • $0\leq y\leq H$
  • $x<L$ or $R<x$ or $y<D$ or $U<y$
翻译中…

Snuke traveled through the town as follows.

翻译中…
  • First, he chooses one block and stands there.
  • Then, he performs the following operation any number of times (possibly zero):
  • Move one unit in the positive direction of the $x$-axis or the positive direction of the $y$-axis. However, the point after moving must also have a block.
翻译中…

Print the number, modulo $998244353$, of possible paths that Snuke could have taken.

翻译中…

Constraints

翻译中…
  • $0\leq L\leq R\leq W\leq 10^6$
  • $0\leq D\leq U\leq H\leq 10^6$
  • There is at least one block.
  • All input values are integers.
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

W H L R D U

翻译中…

Output

翻译中…

Print the answer.

翻译中…

样例

Input #1
4 3 1 2 2 3
Output #1
192
The following are examples of possible paths. Here, a path is represented by listing the lattice points visited in order. - $(3,0)$ - $(0,0)\rightarrow (1,0)\rightarrow (2,0)\rightarrow (2,1)\rightarrow (3,1)\rightarrow (3,2)\rightarrow (4,2)\rightarrow (4,3)$ - $(0,1)\rightarrow (0,2)$ There are $192$ possible paths.
Input #2
10 12 4 6 8 11
Output #2
4519189
Input #3
192 25 0 2 0 9
Output #3
675935675
Do not forget to print the number of paths modulo $998244353$.
题目信息
题号
arc192_e
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。