Codeforces
CF Step
Youtube Linkedin Discord Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Statement : Sum of Fractions

F. Sum of Fractions

An increase of the fraction xy is one of:

  • increase the numerator x by 1, or
  • if y>1, decrease the denominator y by 1.

The fraction is not reduced after an increase (e.g. 3736, not 12).

Given an array b1,b2,,bm and an integer k, consider:

  1. Build fractions 1b1,1b2,,1bm.
  2. Choose any fraction and apply an increase to it.
  3. Repeat step 2 exactly k times (same fraction can be chosen multiple times).
  4. Take the sum of the resulting fractions.

Define MSF(b,k) as the maximum sum achievable over b with exactly k increases.

Let a[lr] denote the subarray al,al+1,,ar.

You are given arrays a1,,an and k1,k2,,km. For each ki, compute

(l=1nr=lnMSF(a[lr],ki))mod998,244,353.

Output each result as PQ1mod998,244,353 (standard modular inverse form).


Input

First line: two integers n and m (1n,m5105).

Second line: n integers a1,,an (1ai108).

Third line: m integers k1k2km (0ki108).


Output

For each ki, output one integer — the sum of MSF over all subarrays modulo 998,244,353.


Example

Input

5 4
2 3 5 2 3
0 1 2 10

Output

232923695
332748137
931694761
133099397

Note

The answers as rationals are 37930, 583, 47315, 224915.