#include <bits/stdc++.h>
using namespace std;
template <typename T>
void chkmin(T &x, T y) {
  x = x < y ? x : y;
}
template <typename T>
void chkmax(T &x, T y) {
  x = x > y ? x : y;
}
template <typename T>
void read(T &x) {
  x = 0;
  int f = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) x = x * 10 + c - '0', c = getchar();
  x *= f;
}
int a[100010], s[100010], f[100010][105], b[100010][105];
void add(int &x, int y) {
  x += y;
  if (x >= 998244353) x -= 998244353;
}
int main() {
  int n, k, len;
  read(n), read(k), read(len);
  if (len == 1) return cout << "0\n", 0;
  s[0] = 1;
  for (int i = 1; i <= n; i++) read(a[i]);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= k; j++)
      if (a[i] == j || a[i] == -1) b[i][j] = 1;
  for (int j = 1; j <= k; j++)
    for (int i = 1; i <= n; i++) b[i][j] += b[i - 1][j];
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      if (~a[i] && a[i] != j) continue;
      f[i][j] = s[i - 1];
      if (i >= len && b[i][j] - b[i - len][j] == len)
        add(f[i][j], (f[i - len][j] - s[i - len] + 998244353) % 998244353);
      add(s[i], f[i][j]);
    }
  }
  cout << s[n] << "\n";
  return 0;
}
