#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
const int max_n = 100005, max_k = 105;
inline int Add(int x, int y) { return (x += y) >= mod ? x - mod : x; }
inline int Sub(int x, int y) { return (x -= y) < 0 ? x + mod : x; }
inline int Mul(int x, int y) { return 1ll * x * y % mod; }
int n, k, len;
int a[max_n];
int cnt[max_k], dp[max_n][max_k], sum[max_n];
int main() {
  scanf("%d%d%d", &n, &k, &len);
  for (int i = 1; i <= n; i++) scanf("%d", a + i), a[i] = max(a[i], 0);
  sum[0] = 1;
  for (int i = 1; i <= n; i++) {
    cnt[a[i]]++;
    if (a[i]) {
      dp[i][a[i]] = sum[i - 1];
      if (i >= len && cnt[a[i]] + cnt[0] == len)
        dp[i][a[i]] = Sub(dp[i][a[i]], Sub(sum[i - len], dp[i - len][a[i]]));
    } else {
      for (int j = 1; j <= k; j++) {
        dp[i][j] = sum[i - 1];
        if (i >= len && cnt[j] + cnt[0] == len)
          dp[i][j] = Sub(dp[i][j], Sub(sum[i - len], dp[i - len][j]));
      }
    }
    if (i >= len) cnt[a[i - len + 1]]--;
    for (int j = 1; j <= k; j++) sum[i] = Add(sum[i], dp[i][j]);
  }
  printf("%d\n", sum[n]);
  return 0;
}
