#include <bits/stdc++.h>
using namespace std;
int di[] = {0, 0, 1, -1, 1, 1, -1, -1};
int dj[] = {1, -1, 0, 0, -1, 1, 1, -1};
const int N = 1e5 + 5, M = 105, MOD = 998244353;
int n, k, len;
int arr[N], dp[N][M], sum[N], cand[N];
int add(int a, int b) {
  a += b;
  while (a >= MOD) a -= MOD;
  while (a < 0) a += MOD;
  return a;
}
void pre() {
  memset(cand, -1, sizeof cand);
  multiset<int> ms;
  for (int i = 1; i <= len; i++)
    if (~arr[i]) ms.insert(arr[i]);
  if (!ms.size() || *ms.begin() == *ms.rbegin()) cand[len] = *ms.begin();
  for (int i = len + 1; i <= n; i++) {
    if (~arr[i]) ms.insert(arr[i]);
    if (~arr[i - len]) ms.erase(ms.find(arr[i - len]));
    if (!ms.size() || *ms.begin() == *ms.rbegin()) cand[i] = *ms.begin();
  }
}
int main() {
  scanf("%d%d%d", &n, &k, &len);
  for (int i = 1; i <= n; i++) scanf("%d", arr + i);
  pre();
  sum[0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int x = 1; x <= k; x++) {
      if (arr[i] == -1 || arr[i] == x) {
        dp[i][x] = sum[i - 1];
        if (cand[i] == x || !cand[i])
          dp[i][x] = add(dp[i][x], add(-sum[i - len], dp[i - len][x]));
        sum[i] = add(sum[i], dp[i][x]);
      }
    }
  }
  printf("%d\n", sum[n]);
}
