#include <bits/stdc++.h>
using namespace std;
int n, k, len;
deque<int> q[((int)101)];
int dp_total[((int)101 * 1000)];
int sum[((int)101)], sum_total;
int sub(int x, int y) {
  int p = x - y;
  if (p < 0) p += ((int)998244353);
  return p;
}
int add(int x, int y) {
  int p = x + y;
  if (p >= ((int)998244353)) p -= ((int)998244353);
  return p;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k >> len;
  dp_total[0] = 1;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    if (x == -1) {
      for (int j = 1; j <= k; j++) {
        int dp0 = sub(dp_total[i - 1], sum[j]);
        q[j].push_back(dp0);
        sum[j] = add(sum[j], dp0);
        sum_total = add(sum_total, dp0);
        if (q[j].size() > len - 1)
          sum[j] = sub(sum[j], q[j].front()),
          sum_total = sub(sum_total, q[j].front()), q[j].pop_front();
      }
    } else {
      for (int j = 1; j <= k; j++)
        if (j != x) {
          q[j].clear();
          sum_total = sub(sum_total, sum[j]);
          sum[j] = 0;
        }
      int dp0 = sub(dp_total[i - 1], sum[x]);
      q[x].push_back(dp0);
      sum[x] = add(sum[x], dp0);
      sum_total = add(sum_total, dp0);
      if (q[x].size() > len - 1)
        sum[x] = sub(sum[x], q[x].front()),
        sum_total = sub(sum_total, q[x].front()), q[x].pop_front();
    }
    dp_total[i] = sum_total;
  }
  cout << dp_total[n] << "\n";
  return 0;
}
