시간 제한메모리 제한제출정답맞힌 사람정답 비율
4 초 1024 MB17175100.000%

문제

You have $R$ red balls, $B$ blue balls, and one green ball. You are going to arrange the balls in a row. The score of an arrangement is defined as follows:

  • Let $l_{\mathrm{R}},l_{\mathrm{B}},r_{\mathrm{R}},r_{\mathrm{B}}$ be the number of red/blue balls to the left/right of the green ball, respectively. Then, the score is the maximum integer $x$ such that $l_{\mathrm{B}} \times x \leq l_{\mathrm{R}}$ and $r_{\mathrm{B}} \times x \leq r_{\mathrm{R}}$.

Find the sum of scores of all possible arrangements, modulo $998244353$. Note that balls of the same color cannot be distinguished, thus two arrangements are considered different if and only if there is such an $i$ that the color of the $i$-th ball in the first arrangement differs from that of the second.

입력

The first line contains integers $R$ ($1 \leq R \leq 10^{18}$) and $B$ ($1 \leq B \leq 10^6$).

출력

Print the answer.

예제 입력 1

10 3

예제 출력 1

8390

예제 입력 2

3 10

예제 출력 2

0

예제 입력 3

100 10

예제 출력 3

801171977

예제 입력 4

999999999999999999 999999

예제 출력 4

448294209