Problem: While roaming the mystic areas of Stonefalls, in order to drop legendary loot, an adventurer was given a quest as follows. He was given an array A = {a_1,a_2,...,a_N } of length N, and a number K.

Define array B as B(q, A) =  { q-a_1, q-a_2, ..., q-a_N }. Define function F as F(B,K) being sum of products of all K-tuples of elements in array B. For example, if the array B is [2,3,4,5], and with K=3, sum of products of all 3-tuples is $$$F(B, 3) = 2*3*4+2*3*5+3*4*5+2*4*5$$$

He was then given a number Q, number of queries of two types: 

  * Type 1: Given q, i, and d calculate F(B(q, A), K) where we make change to initial array as A[i] = d. 
  * Type 2: Given q, L, R, and d calculate F(B(q, A), K) where we make change to initial array as A[i] = A[i] + d for all i in range [L, R] inclusive. 



All changes are temporarily made to initial array, and don't propagate to following queries. Help the adventurer calculate the answer to a quest, and finally get that loot!

Input

In the first two lines, numbers N (1 ≤ N ≤ 2*10^4) and K (1 ≤ K ≤ N), the length of initial array A, and tuple size, followed by a_1,a_2,a_3,…,a_N (0 ≤ a_i ≤ 10^9) , elements of array A, in the next line. Then follows number Q (Q ≤ 10), number of queries. In the next Q lines come queries of the form: 

  * 1 q i d, for type 1, 
  * 2 q L R d, for type 2, 



as explained above (0 ≤ q, d ≤ 10^9, 1 ≤ i,L,R ≤ N)

Output

Print Q lines, the answers to queries, modulo 998244353.

Example

Input


5
2
1 2 3 4 5
3
1 6 1 1
1 6 5 2
2 6 2 3 1


Output


85
127
63

Note

In the first query array A = [1, 2, 3, 4, 5], B = [5, 4, 3, 2, 1], sum of products of 2-tuples = 85.

In second query array A = [1, 2, 3, 4, 2], B = [5, 4, 3, 2, 4], sum of products of 2-tuples = 127

In third query array A = [1, 3, 4, 4, 5], B = [5, 3, 2, 2, 1], sum of products of 2-tuples = 63

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
long long int const N = 1000005;
long long int const LN = 20;
long long int const inf = 8e18;
long long int const MOD = 998244353;
using namespace std;
long long int w[2][N];
inline long long int qp(long long int a, long long int b) {
  long long int ans = 1;
  while (b) {
    if (b & 1) {
      ans = ans * a % MOD;
    }
    a = a * a % MOD;
    b >>= 1;
  }
  return ans;
}
int K;
inline void fftinit(int n) {
  for (K = 1; K < n; K <<= 1)
    ;
  w[0][0] = w[0][K] = 1;
  long long int g = qp(3, (MOD - 1) / K);
  for (int i = 1; i < K; i++) {
    w[0][i] = w[0][i - 1] * g % MOD;
  }
  for (int i = 0; i <= K; i++) {
    w[1][i] = w[0][K - i];
  }
}
long long int rev[N];
inline void fft(int* x, int v) {
  for (int i = 0; i < K; i++) {
    x[i] = (x[i] % MOD + MOD) % MOD;
  }
  for (int i = 0, j = 0; i < K; i++) {
    if (i > j) {
      swap(x[i], x[j]);
      rev[i] = j;
    }
    for (int l = K >> 1; (j ^= l) < l; l >>= 1)
      ;
  }
  for (int i = 2; i <= K; i <<= 1)
    for (int l = 0; l < i >> 1; l++) {
      register int W = w[v][K / i * l], *p = x + l + (i >> 1), *q = x + l, t;
      for (register int j = 0; j < K; j += i) {
        p[j] = (q[j] - (t = (long long int)p[j] * W % MOD) < 0)
                   ? (q[j] - t + MOD)
                   : (q[j] - t);
        q[j] = (q[j] + t - MOD >= 0) ? (q[j] + t - MOD) : (q[j] + t);
      }
    }
  if (!v) {
    return;
  }
  long long int rv = qp(K, MOD - 2);
  for (int i = 0; i < K; i++) {
    x[i] = x[i] * rv % MOD;
  }
}
struct poly {
  vector<int> ps;
  inline int cs() { return ps.size() - 1; }
  inline int& operator[](int x) { return ps[x]; }
  inline void sc(int x) { ps.resize(x + 1); }
  inline void dbg() {
    bool fi = 0;
    for (int i = cs(); i >= 0; i--) {
      ps[i] = (ps[i] % MOD + MOD) % MOD;
      if (!ps[i]) {
        continue;
      }
      if (ps[i] > MOD / 2) {
        ps[i] -= MOD;
      }
      if (fi) {
        if (i == 0) {
          printf("%+d", ps[i]);
        } else if (ps[i] == 1) {
          printf("+");
        } else if (ps[i] == -1) {
          printf("-");
        } else {
          printf("%+d", ps[i]);
        }
      } else {
        if (i == 0) {
          printf("%d", ps[i]);
        } else if (ps[i] == 1)
          ;
        else if (ps[i] == -1) {
          printf("-");
        } else {
          printf("%d", ps[i]);
        }
      }
      if (i > 1) {
        printf("x^%d", i);
      } else if (i == 1) {
        printf("x");
      }
      fi = 1;
    }
    if (!fi) {
      printf("0");
    }
    putchar(10);
  }
  inline void clr() {
    int p = cs() + 1;
    while (p && !ps[p - 1]) {
      --p;
    }
    sc(p - 1);
  }
};
namespace PolyMul {
int ta[N], tb[N], tc[N];
}
inline poly operator*(poly& a, poly b) {
  using namespace PolyMul;
  if (a.cs() < 50 || b.cs() < 50) {
    poly g;
    g.sc(a.cs() + b.cs());
    int *G = &g[0], *A = &a[0], *B = &b[0];
    for (int i = 0; i <= a.cs(); i++) {
      register int *h = G + i, j = 0;
      register long long int x = A[i];
      for (; j <= b.cs(); ++j) {
        h[j] = (h[j] + x * (long long int)B[j]) % MOD;
      }
    }
    return g;
  }
  poly c;
  int t = a.cs() + b.cs();
  c.sc(t);
  fftinit(t + 1);
  memset(ta, 0, sizeof(int) * K);
  memset(tb, 0, sizeof(int) * K);
  memset(tc, 0, sizeof(int) * K);
  for (int i = b.cs(); i >= 0; i--) {
    tb[i] = b[i];
  }
  for (int i = a.cs(); i >= 0; i--) {
    ta[i] = a[i];
  }
  fft(ta, 0);
  fft(tb, 0);
  for (int i = 0; i < K; i++) {
    tc[i] = (long long int)ta[i] * tb[i] % MOD;
  }
  fft(tc, 1);
  for (int i = t; i >= 0; i--) {
    c[i] = tc[i];
  }
  c.clr();
  return c;
}
namespace PolyInv {
int ay[N], a0[N], tmp[N];
}
inline void ginv(int t) {
  using namespace PolyInv;
  if (t == 1) {
    a0[0] = qp(ay[0], MOD - 2);
    return;
  }
  ginv((t + 1) >> 1);
  fftinit(t + t + 3);
  memset(tmp, 0, sizeof(int) * K);
  for (int i = t; i < K; i++) {
    tmp[i] = a0[i] = 0;
  }
  for (int i = 0; i < t; i++) {
    tmp[i] = ay[i];
  }
  fft(tmp, 0);
  fft(a0, 0);
  for (int i = 0; i < K; i++) {
    a0[i] = (2 - (long long int)tmp[i] * a0[i]) % MOD * a0[i] % MOD;
  }
  fft(a0, 1);
  for (int i = t; i < K; i++) {
    a0[i] = 0;
  }
}
inline poly inv(poly x) {
  using namespace PolyInv;
  poly y;
  y.sc(x.cs());
  for (int i = x.cs(); i >= 0; i--) {
    ay[i] = x[i];
  }
  ginv(x.cs() + 1);
  for (int i = x.cs(); i >= 0; i--) {
    y[i] = a0[i];
  }
  y.clr();
  return y;
}
inline poly operator+(poly a, poly b) {
  poly w;
  w.sc(max(a.cs(), b.cs()));
  for (int i = a.cs(); i >= 0; i--) {
    w[i] = a[i];
  }
  for (int i = b.cs(); i >= 0; i--) {
    (w[i] += b[i]) %= MOD;
  }
  return w;
}
inline poly operator-(poly a, poly b) {
  poly w;
  w.sc(max(a.cs(), b.cs()));
  for (int i = a.cs(); i >= 0; i--) {
    w[i] = a[i];
  }
  for (int i = b.cs(); i >= 0; i--) {
    (w[i] -= b[i]) %= MOD;
  }
  w.clr();
  return w;
}
inline void div(poly a, poly b, poly& d, poly& r) {
  int n = a.cs(), m = b.cs();
  if (n < m) {
    d.sc(0);
    d[0] = 0;
    r = a;
    return;
  }
  fftinit(2 * n);
  poly aa = a;
  reverse(aa.ps.begin(), aa.ps.end());
  poly bb = b;
  reverse(bb.ps.begin(), bb.ps.end());
  bb.sc(n - m);
  bb = inv(bb);
  d = aa * bb;
  d.sc(n - m);
  reverse(d.ps.begin(), d.ps.end());
  r = a - b * d;
  r.clr();
}
inline poly operator/(poly a, poly b) {
  poly d, r;
  div(a, b, d, r);
  return d;
}
inline poly operator%(poly a, poly b) {
  a.clr();
  b.clr();
  if (a.cs() < b.cs()) {
    return a;
  }
  poly d, r;
  div(a, b, d, r);
  return r;
}
inline poly dev(poly x) {
  if (x.cs() < 0) {
    return x;
  }
  for (int i = 1; i <= x.cs(); i++) {
    x[i - 1] = (long long int)x[i] * i % MOD;
  }
  x.sc(x.cs() - 1);
  return x;
}
inline long long int qz(poly& a, long long int x) {
  long long int ans = 0;
  for (int i = a.cs(); i >= 0; i--) {
    ans = (ans * x + a[i]) % MOD;
  }
  return ans;
}
long long int const SZ = N;
poly vvs[SZ];
inline void gvs(int m, int* x, int id) {
  if (m == 1) {
    vvs[id].sc(1), vvs[id][1] = 1, vvs[id][0] = -*x;
    return;
  }
  int hf = m >> 1;
  gvs(hf, x, id * 2);
  gvs(m - hf, x + hf, id * 2 + 1);
  vvs[id] = vvs[id * 2] * vvs[id * 2 + 1];
}
namespace PolyGetv {
int xs[SZ], anss[SZ];
}
inline void gv(poly first, int m, int* x, int* ans, int id) {
  if (first.cs() <= 400) {
    int c = first.cs(), *F = &first.ps[0];
    for (int i = 0; i < m; i++) {
      register long long int t = 0;
      register int v = x[i];
      for (register int j = c; ~j; --j) {
        t = (t * v + F[j]) % MOD;
      }
      ans[i] = t;
    }
    return;
  }
  int hf = m >> 1;
  gv(first % vvs[id * 2], hf, x, ans, id * 2);
  gv(first % vvs[id * 2 + 1], m - hf, x + hf, ans + hf, id * 2 + 1);
}
inline vector<int> getv(poly a, vector<int> x) {
  using namespace PolyGetv;
  a.clr();
  if (!x.size()) {
    return vector<int>();
  }
  int m = x.size();
  for (int i = 0; i < m; i++) {
    xs[i] = x[i];
  }
  gvs(m, xs, 1);
  gv(a % vvs[1], m, xs, anss, 1);
  vector<int> ans;
  ans.resize(m);
  for (int i = 0; i < m; i++) {
    ans[i] = anss[i];
  }
  return ans;
}
int n, a[SZ], b[SZ];
vector<poly> v[20];
long long int k;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  for (long long int i = 0; i < N; i++) {
    rev[i] = -1;
  }
  long long int n;
  cin >> n >> k;
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long int q;
  cin >> q;
  for (long long int j = 1; j <= q; j++) {
    long long int tp;
    cin >> tp;
    if (tp == 1) {
      long long int q, ii, d;
      cin >> q >> ii >> d;
      ii--;
      for (long long int i = 0; i < n; i++) {
        b[i] = q - a[i];
      }
      b[ii] = q - d;
      for (long long int i = 0; i < n; i++) {
        b[i] %= MOD;
        if (b[i] < 0) {
          b[i] += MOD;
        }
        poly temp;
        temp.sc(2);
        temp[0] = 1;
        temp[1] = b[i];
        v[0].push_back(temp);
      }
      long long int l = n;
      long long int p = 0;
      poly res;
      while (l > 1) {
        p++;
        for (long long int i = 0; i < l / 2; i++) {
          v[p].push_back(res);
          v[p][i] = v[p - 1][2 * i] * v[p - 1][2 * i + 1];
        }
        if (l % 2) {
          v[p].push_back(v[p - 1][l - 1]);
        }
        l = v[p].size();
      }
      long long int ok = v[p][0][k];
      ok %= MOD;
      if (ok < 0) {
        ok += MOD;
      }
      cout << ok << '\n';
      for (long long int i = 0; i <= p; i++) {
        v[i].clear();
      }
    } else {
      long long int q, l, r, d;
      cin >> q >> l >> r >> d;
      l--;
      r--;
      for (long long int i = 0; i < n; i++) {
        b[i] = q - a[i];
      }
      for (long long int i = l; i <= r; i++) {
        b[i] = q - a[i] - d;
      }
      for (long long int i = 0; i < n; i++) {
        b[i] %= MOD;
        if (b[i] < 0) {
          b[i] += MOD;
        }
        poly temp;
        temp.sc(2);
        temp[0] = 1;
        temp[1] = b[i];
        v[0].push_back(temp);
      }
      l = n;
      long long int p = 0;
      poly res;
      while (l > 1) {
        p++;
        for (long long int i = 0; i < l / 2; i++) {
          v[p].push_back(res);
          v[p][i] = v[p - 1][2 * i] * v[p - 1][2 * i + 1];
        }
        if (l % 2) {
          v[p].push_back(v[p - 1][l - 1]);
        }
        l = v[p].size();
      }
      long long int ok = v[p][0][k];
      ok %= MOD;
      if (ok < 0) {
        ok += MOD;
      }
      cout << ok << '\n';
      for (long long int i = 0; i <= p; i++) {
        v[i].clear();
      }
    }
  }
  return 0;
}