{"raw_statement":[{"iden":"problem statement","content":"You are given a string $S$ of length $N$ consisting of `0` and `1`. We define an **inversion pair** as a pair of integers $(i, j)$ ($1 \\leq i < j \\leq N$) such that the $i$\\-th character of $S$ is `1` and the $j$\\-th character of $S$ is `0`.\nAs long as there is an inversion pair in $S$, perform the following operation:\n\n*   Randomly choose an inversion pair $(i, j)$. The choice is independent of previous choices and is uniformly random. Then, swap the $i$\\-th and $j$\\-th characters of $S$.\n\nFind the expected number of operations, modulo $998244353$.\nWhat is the expected value modulo $998244353$?It can be proved that the sought expected value is always rational. Moreover, under the constraints of this problem, it can be proved that if the expected value is expressed as an irreducible fraction $\\frac{P}{Q}$, then $Q \\neq 0 \\pmod{998244353}$. Thus, there exists a unique integer $R$ such that $R \\times Q \\equiv P \\pmod{998244353}, 0 \\leq R < 998244353$. Report this $R$."},{"iden":"constraints","content":"*   $1 \\leq N \\leq 250000$\n*   $S$ is a string of length $N$ consisting of `0` and `1`."},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$N$\n$S$"},{"iden":"sample input 1","content":"2\n10"},{"iden":"sample output 1","content":"1\n\nThe expected number of operations is $1$."},{"iden":"sample input 2","content":"3\n110"},{"iden":"sample output 2","content":"499122178\n\nThe expected number of operations is $3/2$."},{"iden":"sample input 3","content":"1\n0"},{"iden":"sample output 3","content":"0"},{"iden":"sample input 4","content":"10\n1011000010"},{"iden":"sample output 4","content":"133099253"},{"iden":"sample input 5","content":"100\n0101110010001000111000111001001101001100000111110001010010001010101100011001011011101101100001100111"},{"iden":"sample output 5","content":"407907276"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}