#include <bits/stdc++.h>
using namespace std;
const int maxn = 200005;
const int mod = 998244353;
int add(int x, int y) {
  x += y;
  return x >= mod ? x - mod : x;
}
int sumdp[maxn], dp[maxn][105];
int len, k, n, nm[maxn], cnt[105][maxn];
int main() {
  scanf("%d%d%d", &n, &k, &len);
  if (len == 1) {
    puts("0");
    return 0;
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &nm[i]);
    for (int j = 1; j <= k; j++) {
      cnt[j][i] = cnt[j][i - 1] + (nm[i] == -1 || nm[i] == j);
    }
  }
  if (nm[1] == -1) {
    for (int j = 1; j <= k; j++) dp[1][j] = 1;
    sumdp[1] = k;
  } else
    dp[1][nm[1]] = 1, sumdp[1] = 1;
  for (int i = 2; i <= n; i++) {
    if (nm[i] != -1) {
      int j = nm[i];
      dp[i][j] = sumdp[i - 1];
      if (i < len || cnt[j][i] - cnt[j][i - len] != len) goto zz;
      if (i == len)
        dp[i][j] = add(dp[i][j], mod - 1);
      else
        dp[i][j] = add(dp[i][j], add(mod - sumdp[i - len], dp[i - len][j]));
    } else {
      for (int j = 1; j <= k; j++) {
        dp[i][j] = sumdp[i - 1];
        if (i < len || cnt[j][i] - cnt[j][i - len] != len) continue;
        if (i == len)
          dp[i][j] = add(dp[i][j], mod - 1);
        else
          dp[i][j] = add(dp[i][j], add(mod - sumdp[i - len], dp[i - len][j]));
      }
    }
  zz:
    for (int j = 1; j <= k; j++) sumdp[i] = add(sumdp[i], dp[i][j]);
  }
  printf("%d", sumdp[n]);
}
