#include <bits/stdc++.h>
using namespace std;
template <class T>
bool umin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool umax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
int arr[100009];
bool good(int l, int r, int k) {
  for (int i = l; i <= r; i++)
    if (~arr[i] and arr[i] != k) return 0;
  return 1;
}
const int K = 103;
int dp[K], bad[K], f[100009][K], par[100009];
int mod(int x) {
  if (x < 0) x += 998244353;
  if (x >= 998244353) x -= 998244353;
  return x;
}
int main() {
  int n, k, len;
  scanf("%d%d%d", &n, &k, &len);
  for (int i = 1; i <= n; i++) scanf("%d", arr + i);
  if (len == 1) {
    puts("0");
    return 0;
  }
  int ans = 0, pos;
  for (int i = 1; i <= n; i++) {
    par[i] = par[i - 1];
    if (~arr[i]) {
      for (int j = 1; j <= k; j++)
        if (j != arr[i]) bad[j] = i;
    }
    for (int h = 1; h <= k; h++) {
      f[i][h] = f[i - 1][h];
      dp[h] = 0;
      if (~arr[i] and arr[i] != h) continue;
      if (i < len and !bad[h]) dp[h] = 1;
      pos = max(1, max(bad[h], i - len + 1));
      dp[h] = mod(dp[h] + par[i - 1] - par[pos - 1]);
      dp[h] = mod(dp[h] - f[i - 1][h] + f[pos - 1][h]);
      f[i][h] = mod(f[i][h] + dp[h]);
      par[i] = mod(par[i] + dp[h]);
    }
  }
  for (int i = 1; i <= k; i++) ans = mod(ans + dp[i]);
  printf("%d\n", ans);
  return 0;
}
