#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353, inf = 0x3f3f3f3f;
const int NN = 2e5 + 10;
int flag[NN], kval[NN], cnt[NN], e[NN], cur, M;
struct query {
  int L, R, id;
  query(int L = 0, int R = 0, int id = 0) : L(L), R(R), id(id) {}
  bool operator<(const query q) const {
    return pair<int, int>(L / M, R) < pair<int, int>(q.L / M, q.R);
  }
};
vector<query> Q[111];
int mul[NN], ans[NN], inv[NN], tot[NN], C;
int kcnt[NN];
void add(int tp) {
  C = (long long)C * (kcnt[tp] - tot[tp]) % mod;
  tot[tp]++;
}
void del(int tp) {
  tot[tp]--;
  C = (long long)C * inv[kcnt[tp] - tot[tp]] % mod;
}
int Inv(int a) {
  if (a < 2) return a;
  return (long long)mod / a * (mod - Inv(mod % a)) % mod;
}
int main() {
  int n, m, q, L, R, k;
  for (int i = 1; i < NN; i++) inv[i] = Inv(i);
  scanf("%d %d %d", &n, &m, &q);
  for (int i = 1; i <= n; i++) {
    scanf("%d", e + i);
    cnt[e[i]]++;
  }
  for (int i = 0; i < q; i++) {
    scanf("%d %d %d", &L, &R, &k);
    if (flag[k] == 0) {
      flag[k] = ++cur;
      kval[cur] = k;
    }
    Q[flag[k]].push_back(query(L, R, i));
  }
  M = (int)sqrt(n * 2) + 1;
  for (int i = 1; i <= cur; i++) {
    int L = (long long)kval[i] * m % mod;
    mul[n] = 1;
    for (int j = n; --j;) {
      L++;
      mul[j] = (long long)mul[j + 1] * L % mod;
    }
    for (int j = 1; j <= m; j++) kcnt[j] = cnt[j] + kval[i];
    for (int j = C = 1; j <= m; j++) tot[j] = 0;
    vector<query> Q = ::Q[i];
    sort(Q.begin(), Q.end());
    int curL = 1, curR = 0;
    for (int i = 0; i < Q.size(); i++) {
      int L = Q[i].L, R = Q[i].R;
      for (; L < curL; add(e[--curL]))
        ;
      for (; R > curR; add(e[++curR]))
        ;
      for (; L > curL; del(e[curL++]))
        ;
      for (; R < curR; del(e[curR--]))
        ;
      ans[Q[i].id] = (long long)C * mul[R - L + 1] % mod;
    }
  }
  for (int i = 0; i < q; i++) printf("%d\n", ans[i]);
  return 0;
}
