#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 13;
const int MAXM = 113;
const long long MOD = 998244353;
int t[MAXN];
int licz[MAXM];
long long dp[MAXN][MAXM];
long long sum[MAXN];
queue<int> q;
int main() {
  int n, d;
  int x, ile = 1;
  long long k, y;
  bool b = false;
  t[0] = -1;
  scanf("%d %lld %d", &n, &k, &d);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x);
    t[i] = x;
    for (int j = 1; j <= k; j++) {
      sum[i - 1] += dp[i - 1][j];
      sum[i - 1] %= MOD;
    }
    if (i != 1)
      y = sum[i - 1];
    else
      y = 1;
    if (x == -1) {
      ile++;
      for (int j = 1; j <= k; j++) dp[i][j] = y;
    } else {
      licz[x]++;
      q.push(x);
      dp[i][x] = y;
    }
    if (i < d) continue;
    if (t[i - d] == -1)
      ile--;
    else {
      licz[q.front()]--;
      q.pop();
    }
    if (i == d) {
      if (q.empty()) {
        for (int j = 1; j <= k; j++) {
          dp[i][j]--;
          dp[i][j] = (dp[i][j] + MOD) % MOD;
        }
      } else if (licz[q.front()] + ile == d) {
        if (ile == 0) b = true;
        dp[i][q.front()]--;
        dp[i][q.front()] = (dp[i][q.front()] + MOD) % MOD;
      }
      continue;
    }
    if (q.empty()) {
      for (int j = 1; j <= k; j++) {
        dp[i][j] -= sum[i - d] - dp[i - d][j];
        dp[i][j] = (dp[i][j] + MOD) % MOD;
      }
    } else if (licz[q.front()] + ile == d) {
      if (ile == 0) b = true;
      dp[i][q.front()] -= sum[i - d] - dp[i - d][q.front()];
      dp[i][q.front()] = (dp[i][q.front()] + MOD) % MOD;
    }
  }
  if (b)
    printf("0");
  else {
    long long wyn = 0;
    for (int i = 1; i <= k; i++) wyn = (wyn + dp[n][i]) % MOD;
    printf("%lld", wyn);
  }
  return 0;
}
