You are given
Edge $i$ connects vertices $u _ i$ and $v _ i$ bidirectionally.
For an integer $e$ that satisfies $0 \leq e \leq N-2$ , let $f _ e(x) = b _ e x + c _ e$ .
Let $e _ 0, e _ 1, \ldots, e _ k$ be the edges on the simple path from vertex $x$ to vertex $y$ in order, and define $P(x, y) = f _ {e _ 0}(f _ {e _ 1}(\ldots f _ {e _ k}(a _ y) \ldots ))$ .
Find $q _ x = \sum _ {y=0} ^ {N-1} P(x, y)$ modulo $998244353$ for each vertex $x$ .
$N$
$a _ 0$ $a _ 1$ $\ldots$ $a _ {N-1}$
$u _ 0$ $v _ 0$ $b _ 0$ $c _ 0$
$u _ 1$ $v _ 1$ $b _ 1$ $c _ 1$
$\vdots$
$u _ {N-2}$ $v _ {N-2}$ $b _ {N-2}$ $c _ {N-2}$
$q _ 0$ $q _ 1$ $\ldots$ $q _ {N-1}$
8 1 2 3 4 5 6 7 8 0 1 10 1 1 2 10 1 0 3 10 1 0 4 10 0 0 5 10 1 5 6 10 0 6 7 10 1
9287 89589 895590 92471 92375 5131 42598 425185
3 1 100 10000 0 1 100000 0 1 2 100000 0
881938226 1855747 27566470
| No. | Testdata Range | Score |
|---|