# Input Format

• $2\leq n\leq 10^ 5$
• $1\leq q\leq 10^ 5$
• $1\leq m_i\leq 10^ 5$
• $\sum\limits_{i=1}^ n m_i\leq 2\times 10^ 5$
• $1\leq a_{i,j}< 998244353$
• $1\leq x,y\leq n,x\neq y$

2 2
2 3 1
3 2 2 1
1 2
2 1

610038216
166374059

4 12
5 15 6 9 5 12
5 13 15 10 9 16
6 1 14 5 14 3 8
4 7 13 15 2
1 2
1 3
1 4
2 1
2 3
2 4
3 1
3 2
3 4
4 1
4 2
4 3

471836831
677881860
641371997
736862175
89482937
679206098
201431450
979230175
731996343
845070522
174820742
2513894

# Hints

$6^ {-1}\equiv 166374059\ (\text{mod }998244353)$，故輸出 $166374059$。

# Problem Source

No. Testdata Range Constraints Score
1 0~1 範例測資 0
2 0~6 $m_i\leq 10$ 21
3 0, 2, 7~9 $q\leq 10$ 28
4 0~50 無其他限制 51

# Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 3000 524288 65536 1 2 3 4
1 3000 524288 65536 1 2 4
2 3000 524288 65536 2 3 4
3 3000 524288 65536 2 4
4 3000 524288 65536 2 4
5 3000 524288 65536 2 4
6 3000 524288 65536 2 4
7 3000 524288 65536 3 4
8 3000 524288 65536 3 4
9 3000 524288 65536 3 4
10 3000 524288 65536 4
11 3000 524288 65536 4
12 3000 524288 65536 4
13 3000 524288 65536 4
14 3000 524288 65536 4
15 3000 524288 65536 4
16 3000 524288 65536 4
17 3000 524288 65536 4
18 3000 524288 65536 4
19 3000 524288 65536 4
20 3000 524288 65536 4
21 3000 524288 65536 4
22 3000 524288 65536 4
23 3000 524288 65536 4
24 3000 524288 65536 4
25 3000 524288 65536 4
26 3000 524288 65536 4
27 3000 524288 65536 4
28 3000 524288 65536 4
29 3000 524288 65536 4
30 3000 524288 65536 4
31 3000 524288 65536 4
32 3000 524288 65536 4
33 3000 524288 65536 4
34 3000 524288 65536 4
35 3000 524288 65536 4
36 3000 524288 65536 4
37 3000 524288 65536 4
38 3000 524288 65536 4
39 3000 524288 65536 4
40 3000 524288 65536 4
41 3000 524288 65536 4
42 3000 524288 65536 4
43 3000 524288 65536 4
44 3000 524288 65536 4
45 3000 524288 65536 4
46 3000 524288 65536 4
47 3000 524288 65536 4
48 3000 524288 65536 4
49 3000 524288 65536 4
50 3000 524288 65536 4