#include <bits/stdc++.h>
using namespace std;
const int p = 998244353;
int n, k, len, i, j, mn, a[100010], f[100010][102], h[100010][102], g[100010],
    pr[100010][102];
int main() {
  scanf("%d%d%d", &n, &k, &len);
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (j = 1; j <= k; j++) pr[0][j] = -1;
  for (j = 1; j <= k; j++)
    for (i = 1; i <= n; i++)
      if (a[i] == -1 || a[i] == j)
        pr[i][j] = pr[i - 1][j];
      else
        pr[i][j] = i - 1;
  g[0] = 1;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= k; j++) {
      if (a[i] == -1 || a[i] == j) {
        f[i][j] = g[i - 1];
        mn = max(pr[i][j], i - len);
        if (mn >= 0) {
          f[i][j] = (f[i][j] - g[mn] + p) % p;
          f[i][j] = (f[i][j] + h[mn][j]) % p;
          f[i][j] = (f[i][j] - h[i - 1][j] + p) % p;
        } else {
          f[i][j] = (f[i][j] - h[i - 1][j] + p) % p;
        }
      }
      h[i][j] = (h[i - 1][j] + f[i][j]) % p;
      g[i] = (g[i] + f[i][j]) % p;
    }
    g[i] = (g[i] + g[i - 1]) % p;
  }
  printf("%d", (g[n] - g[n - 1] + p) % p);
}
