Contest Duration: - (local time) (120 minutes) Back to Home
F - Colorful Star /

Time Limit: 2 sec / Memory Limit: 1024 MB

### 問題文

• 辺で結ばれている 2 頂点 u,v を選ぶ。u の色を v の色に塗り替える。

### 制約

• 1 \le N,M \le 2 \times 10^5

### 入力

N M


### 入力例 1

3 1


### 出力例 1

42


### 入力例 2

4 2


### 出力例 2

219100


### 入力例 3

20 24


### 出力例 3

984288778


### 入力例 4

123456 112233


### 出力例 4

764098676


Score: 1000 points

### 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


### Sample Input 1

3 1


### Sample Output 1

42


One possible sequence of operations is as follows. Including this one, there are 42 possible final trees.

### Sample Input 2

4 2


### Sample Output 2

219100


### Sample Input 3

20 24


### Sample Output 3

984288778


### Sample Input 4

123456 112233


### Sample Output 4

764098676