#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5;
const int MOD = 998244353;
void add(int &a, int b) { a = (1LL * a + b) % MOD; }
int sum[MAXN], dp[MAXN][105], cnt[MAXN][105], a[MAXN];
int main() {
  int n, k, len;
  scanf("%d%d%d", &n, &k, &len);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 0; i < n; i++) {
    for (int j = 1; j <= k; j++) {
      cnt[i + 1][j] = cnt[i][j] + (a[i + 1] == j || a[i + 1] == -1);
    }
  }
  sum[0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      if (a[i] != -1 && j != a[i]) continue;
      dp[i][j] = sum[i - 1];
      bool ok = (i - len >= 0);
      if (!ok) continue;
      int num = cnt[i][j] - cnt[i - len][j];
      ok &= (num >= len);
      if (ok) {
        add(dp[i][j], dp[i - len][j]);
        add(dp[i][j], MOD - sum[i - len]);
      }
    }
    for (int j = 1; j <= k; j++) add(sum[i], dp[i][j]);
  }
  printf("%d\n", sum[n]);
  return 0;
}
