题目描述
Problem Description
Given integers $s, t, u$, where complex numbers $\alpha, \beta, \gamma$ satisfy the following conditions:
- $\alpha + \beta + \gamma = s$
- $\alpha\beta + \beta\gamma + \gamma\alpha = t$
- $\alpha\beta\gamma = u$
- $\alpha, \beta, \gamma$ are distinct.
Given positive integers $n, m$, compute:
\[ \dfrac{\alpha^n(\beta^m-\gamma^m)+\beta^n(\gamma^m-\alpha^m)+\gamma^n(\alpha^m-\beta^m)}{(\alpha-\beta)(\beta-\gamma)(\gamma-\alpha)} \]
The answer is guaranteed to be a rational number, so output it modulo $998244353$.
Input Format
The input is given from the standard input in the following format:
$n$ $m$ $s$ $t$ $u$
Output Format
Output the answer in one line.
Sample Input and Output
Sample Input #1
2 3
314 159 265
Sample Output #1
159
Sample Input #2
1000000000000000000 800000000000000000
6 11 6
Sample Output #2
76083766
Sample Input #3
1000000000000000000 500000000000000000
505459328 165146837 982639180
Sample Output #3
228155372
Notes/Hints
Notes
When outputting a rational number, first represent it as a fraction $\dfrac{y}{x}$, where $x, y$ are integers and $x$ is not divisible by $998244353$ (under the constraints of this problem, such a representation is always possible). Then, output the unique integer $z$ between $0$ and $998244352$ inclusive that satisfies $\equiv y \pmod{998244353}$.
Constraints
- $1 \leq n \leq 10^{18}$
- $1 \leq m \leq 10^{18}$
- $0 \leq s < 998244353$
- $0 \leq t < 998244353$
- $0 \leq u < 998244353$
- $\alpha, \beta, \gamma$ are distinct.
- All inputs are integers.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分