#include <bits/stdc++.h>
using namespace std;
int n, k, l, a[100005], f[100005][105], nx[100005][105], s[100005][105];
void add(int &x, int y) {
  x += y;
  if (x >= 998244353) x -= 998244353;
}
int main() {
  scanf("%d%d%d", &n, &k, &l);
  for (int i = 1; i <= n; ++i) scanf("%d", a + i);
  for (int i = 1; i <= k; ++i) {
    nx[n + 1][i] = n;
    for (int j = n; j; --j) {
      if (a[j] == -1 || a[j] == i)
        nx[j][i] = nx[j + 1][i];
      else
        nx[j][i] = j - 1;
    }
  }
  for (int i = 0; i < n; ++i) {
    int o = (i == 0);
    for (int j = 1; j <= k; ++j) add(o, f[i][j]);
    for (int j = 1; j <= k; ++j) {
      if (a[i + 1] != -1 && a[i + 1] != j) continue;
      int p = o;
      add(p, 998244353 - f[i][j]);
      add(s[i + 1][j], p),
          add(s[min(i + l, nx[i + 1][j] + 1)][j], 998244353 - p);
    }
    for (int j = 1; j <= k; ++j)
      add(s[i + 1][j], s[i][j]), add(f[i + 1][j], s[i + 1][j]);
  }
  int ans = 0;
  for (int i = 1; i <= k; ++i) add(ans, f[n][i]);
  printf("%d\n", ans);
  return 0;
}
