#include <bits/stdc++.h>
using namespace std;
int n, k, len;
int f[100003][103], sum[100003], a[100003], g[103];
int main() {
  scanf("%d%d%d", &n, &k, &len);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  sum[0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++)
      g[j] = (a[i] == -1 || a[i] == j) ? g[j] + 1 : 0;
    if (a[i] == -1) {
      for (int j = 1; j <= k; j++) {
        f[i][j] = sum[i - 1];
        if (g[j] >= len)
          f[i][j] = (f[i][j] -
                     (sum[i - len] - f[i - len][j] + 998244353) % 998244353 +
                     998244353) %
                    998244353;
      }
    } else {
      f[i][a[i]] = sum[i - 1];
      if (g[a[i]] >= len)
        f[i][a[i]] =
            (f[i][a[i]] -
             (sum[i - len] - f[i - len][a[i]] + 998244353) % 998244353 +
             998244353) %
            998244353;
    }
    for (int j = 1; j <= k; j++) sum[i] = (sum[i] + f[i][j]) % 998244353;
  }
  printf("%d\n", sum[n]);
  return 0;
}
