| Adam Gąsienica‑Samek Contest 1 |
|---|
| Finished |
Three integers $$$n$$$, $$$a$$$ and $$$b$$$ are given.
A directed graph with $$$n$$$ vertices numbered $$$1$$$ to $$$n$$$ and $$$\frac{n(n-1)}{2}$$$ edges is created in the following way: for every pair of integers $$$u$$$ and $$$v$$$ where $$$1 \le u \lt v \le n$$$, add an edge which is directed from $$$u$$$ to $$$v$$$ with probability $$$\frac{a}{b}$$$ or from $$$v$$$ to $$$u$$$ otherwise. All edges are chosen independently.
Find the probability that the created graph doesn't contain any cycle.
The input contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$1\le n \le 10^6$$$, $$$1 \le a \lt b \lt 998244353$$$).
Output the probability modulo $$$998244353$$$.
Formally, let $$$M = 998244353$$$. It can be shown that the answer can be expressed as an irreducible fraction $$$\frac{p}{q}$$$, where $$$p$$$ and $$$q$$$ are integers and $$$q \not \equiv 0 \pmod{M}$$$. Output the integer equal to $$$p \cdot q^{-1} \bmod M$$$. In other words, output an integer $$$x$$$ such that $$$0 \le x \lt M$$$ and $$$x \cdot q \equiv p \pmod{M}$$$.
15 1 3
527217576
410977 606205472 662422794
694202137
| Name |
|---|


