#include <bits/stdc++.h>
using namespace std;
long long mod = 998244353, dp[100001][101], ans[100001], del[100001],
          cnt[100001];
int a[100001];
int main() {
  int n, k, len;
  scanf("%d%d%d", &n, &k, &len);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  if (len == 1) {
    printf("0\n");
    return 0;
  }
  ans[0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      if (a[i] == j || a[i] == -1) {
        dp[i][j] = ((ans[i - 1] - del[j]) % mod + mod) % mod;
        cnt[j]++;
        if (cnt[j] >= len - 1)
          del[j] = ((ans[i - len + 1] - dp[i - len + 1][j]) % mod + mod) % mod;
        ans[i] += dp[i][j];
        ans[i] %= mod;
      } else
        cnt[j] = del[j] = 0;
    }
  }
  printf("%lld\n", ans[n]);
}
