#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector")
#pragma GCC target("avx")
using namespace std;
using namespace rel_ops;
using ll = int64_t;
using Pii = pair<int, int>;
using ull = uint64_t;
using Vi = vector<int>;
void run();
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(10);
  run();
  return 0;
}
ll modInv(ll a, ll m) {
  if (a == 1) return 1;
  return ((a - modInv(m % a, a)) * m + 1) / a;
}
constexpr ll MOD = 998244353;
ll n, m, q;
struct Query {
  ll begin, end, k, answer, ord;
  bool operator<(const Query& r) const {
    if (k != r.k) return k < r.k;
    return ord < r.ord;
  }
};
vector<Query> queries;
vector<ll> pattern, inPattern, counts;
ll ansUp, ansDown, mult1;
ll lastK = -1, lastBegin, lastEnd;
void addElem(ll e) {
  ansUp = (ansUp * counts[e]--) % MOD;
  ansDown = (ansDown * mult1--) % MOD;
}
void delElem(ll e) {
  ansUp = (ansUp * ++mult1) % MOD;
  ansDown = (ansDown * ++counts[e]) % MOD;
}
ll handle(ll begin, ll end, ll k) {
  if (lastK != k) {
    lastK = k;
    lastBegin = begin;
    lastEnd = begin;
    ansDown = ansUp = 1;
    mult1 = (m * k) % MOD;
    for (int i = (0); i < (n); i++) {
      mult1 += 1;
      ansUp = (ansUp * mult1) % MOD;
    }
    for (int i = (0); i < (m); i++) counts[i] = (inPattern[i] + k) % MOD;
  }
  while (lastBegin > begin) addElem(pattern[--lastBegin]);
  while (lastEnd < end) addElem(pattern[lastEnd++]);
  while (lastBegin < begin) delElem(pattern[lastBegin++]);
  while (lastEnd > end) delElem(pattern[--lastEnd]);
  ll ans = (ansUp * modInv(ansDown, MOD)) % MOD;
  if (ans < 0) ans += MOD;
  return ans;
}
ll hilbert(ll first, ll second, ll s, ll c = 0) {
  if (s <= 1) return c;
  s /= 2;
  c *= 4;
  if (second < s)
    return hilbert(first & (s - 1), second, s, c + (first >= s) + 1);
  if (first < s) return hilbert(2 * s - second - 1, s - first - 1, s, c);
  return hilbert(second - s, first - s, s, c + 3);
}
void run() {
  cin >> n >> m >> q;
  int moSize = 1;
  while (moSize < n) moSize *= 2;
  pattern.resize(n);
  inPattern.resize(m);
  counts.resize(m);
  for (auto& p : (pattern)) {
    cin >> p;
    p--;
    inPattern[p]++;
  }
  queries.resize(q);
  for (auto& p : (queries)) {
    cin >> p.begin >> p.end >> p.k;
    p.begin--;
    p.ord = hilbert(p.begin, p.end, moSize);
  }
  Vi sorted(q);
  iota((sorted).begin(), (sorted).end(), 0);
  sort((sorted).begin(), (sorted).end(),
       [](ll l, ll r) { return queries[l] < queries[r]; });
  for (auto& i : (sorted)) {
    auto& p = queries[i];
    p.answer = handle(p.begin, p.end, p.k);
  }
  for (auto& p : (queries)) cout << p.answer << '\n';
}
