8972: [yosupo] Other - $\sum_{i=0}^{\infty} \widetilde{r}^i i^d$
[Creator : ]
Description
Let $\widetilde{r}$ be a rational number such that $-1 < \widetilde{r} < 1$ and $\widetilde{r} \equiv r \pmod{998244353}$.
Given integers $r$ and $d$, calculate $\sum_{i=0}^{\infty} \widetilde{r}^i i^d$ modulo $998244353$.
The answer is well-defined under the constraints of this problem.
We define $0^0 = 1$.
Given integers $r$ and $d$, calculate $\sum_{i=0}^{\infty} \widetilde{r}^i i^d$ modulo $998244353$.
The answer is well-defined under the constraints of this problem.
We define $0^0 = 1$.
Input
$r$ $d$
Output
$\mathit{answer}$
Constraints
$0 \le r < 998244353$
$r \ne 1$
$0 \le d \le 10^7$
$r \ne 1$
$0 \le d \le 10^7$
Sample 1 Input
499122177 5
Sample 1 Output
1082