Problem Statement
$N$ coins numbered $0,1,\ldots,N-1$ are arranged in a row. Initially, all coins are face up. Also, you are given a sequence $A$ of length $N$ consisting of integers between $0$ and $N-1$.
Snuke will choose a permutation $p=(p_1,p_2,\ldots,p_N)$ of $(1,\ldots,N)$ at equal probability and perform $N$ operations. In the $i$-th $(1\leq i \leq N)$ operation,
- he flips
$(A_{p_i}+1)$coins: coin$(i-1) \bmod N$, coin$(i-1+1 ) \bmod N$,$\ldots$, and coin$(i -1+ A_{p_i}) \bmod N$.
After the $N$ operations, Snuke receives $k$ yen (the currency in Japan) from his mother, where $k$ is the number of face-up coins.
Find the expected value, modulo $998244353$, of the money Snuke will receive.
Definition of expected value modulo $998244353$ In this problem, we can prove that the sought expected value is always a rational number. Moreover, under the Constraints of this problem, when the sought expected value is represented as an irreducible fraction $\frac{y}{x}$, it is guaranteed that $x$ is indivisible by $998244353$. Then, an integer $z$ between $0$ and $998244352$ such that $xz \equiv y \pmod{998244353}$ is uniquely determined. Find such $z$.
Constraints
$1 \leq N\leq 2\times 10^5$$0\leq A_i \leq N-1$- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
N
A_1 A_2 \ldots A_N
Output
Print the answer.
样例
2
0 1
1
4
3 1 1 2
665496237
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。