#include <bits/stdc++.h>
using namespace std;
int add(int x, int y) { return ((x + y) % 998244353 + 998244353) % 998244353; }
int mul(int x, int y) { return (long long)x * y % 998244353; }
int dp[100005][101];
int pre[100005];
int allLen[101];
void solve() {
  int n, k, len;
  scanf("%d %d %d ", &n, &k, &len);
  if (len == 1) {
    printf("0\n");
    return;
  }
  dp[0][0] = 1;
  pre[0] = 1;
  for (int i = 1; i <= n; ++i) {
    int x;
    scanf("%d ", &x);
    for (int j = 1; j <= k; ++j) {
      if (x == -1 || x == j) {
        allLen[j] = allLen[j] + 1;
      } else {
        allLen[j] = 0;
      }
      int g = min(len - 1, allLen[j]);
      int val = add(pre[i - 1], -dp[i - 1][j]);
      if (i - 1 - g >= 0) {
        val = add(val, add(-pre[i - 1 - g], dp[i - 1 - g][j]));
      }
      dp[i][j] = add(dp[i - 1][j], val);
    }
    pre[i] = pre[i - 1];
    for (int j = 1; j <= k; ++j) {
      pre[i] = add(pre[i], add(dp[i][j], -dp[i - 1][j]));
    }
  }
  printf("%d\n", add(pre[n], -pre[n - 1]));
}
int main() {
  solve();
  return 0;
}
