AtCoder Regular Contest 176 (Sponsored by Mynavi)
F
Colorful Star
AtCoder
⌀ 4046
原题
← E→
翻译中…

Problem Statement

翻译中…

There is a tree with $NM+1$ vertices numbered $0$ to $NM$. The $i$-th edge ($1 \le i \le NM$) connects vertices $i$ and $\max(i-N,0)$.

翻译中…

Initially, vertex $i$ is colored with color $i \bmod N$. You can perform the following operation zero or more times:

翻译中…
  • Choose two vertices $u$ and $v$ connected by an edge. Repaint the color of vertex $u$ with that of vertex $v$.
翻译中…

Find the number, modulo $998244353$, of possible trees after the operations. Two trees are distinguished if and only if some vertex has different colors.

翻译中…

Constraints

翻译中…
  • $1 \le N, M \le 2 \times 10^5$
翻译中…

Input

翻译中…

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

翻译中…

N M

翻译中…

Output

翻译中…

Print the answer.

翻译中…

样例

Input #1
3 1
Output #1
42
One possible sequence of operations is as follows. Including this one, there are $42$ possible final trees. ![image](https://img.atcoder.jp/arc176/star.png)
Input #2
4 2
Output #2
219100
Input #3
20 24
Output #3
984288778
Input #4
123456 112233
Output #4
764098676
题目信息
题号
arc176_f
时间限制
2 s
内存限制
1024 MB

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