#include <bits/stdc++.h>
inline int read() {
  int data = 0, w = 1;
  char ch = getchar();
  while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();
  if (ch == '-') w = -1, ch = getchar();
  while (ch >= '0' && ch <= '9') data = data * 10 + (ch ^ 48), ch = getchar();
  return data * w;
}
const int N(1e5 + 10), M(105), Mod(998244353);
int n, K, L, f[N][M], s[N], len[N][M], a[N];
int main() {
  n = read(), K = read(), L = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= K; j++)
      if (a[i] == -1 || a[i] == j) len[i][j] = len[i - 1][j] + 1;
  s[0] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= K; j++)
      if (a[i] == -1 || a[i] == j) {
        f[i][j] = s[i - 1];
        if (i >= L && len[i][j] >= L)
          f[i][j] = (f[i][j] - s[i - L] + Mod) % Mod,
          f[i][j] = (f[i][j] + f[i - L][j]) % Mod;
        s[i] = (s[i] + f[i][j]) % Mod;
      }
  printf("%d\n", s[n]);
  return 0;
}
