Kevin is playing cards and now he needs to shuffle cardsย ๐mย times. Now let's describe the rule of the ithย shuffle.
For the ithย shuffle:
Now we have Qย questions for you. You have to tell us after mย times of shuffles, what's the expected score of some specific positions' card. Note that for card i, let's denote its score as f(i). In this problem, f(i)ย equals to either iย or i2.
The first line contains three integers n, m, type. When type = 1, f(i) = i. When type = 2, f(i) = i2.
The following line contains mย integers A1 โฆ Am.
The following line contains an integerย Q.
In the following Qย lines, each line contains an integerย ci (1 โค ci โค n), indicating that Kevin wants to know the expected score of the ciย position from top.
For each query, output a single integer on a single line as the answer. If the answer is A/B, please print C (0 โค C < 998244353)ย where A โก C ร B (mod 998244353).
For all test cases, 3 โค n โค 107, 1 โค m, Q โค 5 ร 105, 0 โค Ai โค n, typeย โ [1,2].