#include <bits/stdc++.h>
const int N = 1e5 + 5;
const int K = 105;
const int MOD = 998244353;
int dp[N][K], length[N][K], cnt[N][K];
int a[N], next[N], total[N];
int main() {
  int n, k, len;
  std::cin >> n >> k >> len;
  for (int i = 1; i <= n; ++i) std::cin >> a[i];
  if (len == 1) {
    std::cout << 0 << std::endl;
    return 0;
  }
  next[n + 1] = n + 1;
  for (int i = n; i > 0; i--) {
    if (a[i] == -1)
      next[i] = i;
    else
      next[i] = next[i + 1];
  }
  if (a[1] == -1) {
    for (int i = 1; i <= k; ++i) {
      dp[1][i] = 1;
      length[1][i] = 1;
      cnt[1][i] = 1;
    }
    total[1] = k;
  } else {
    dp[1][a[1]] = 1;
    length[1][a[1]] = 1;
    cnt[1][a[1]] = 1;
    total[1] = 1;
  }
  for (int i = 1; i <= k; ++i) dp[0][i] = 1;
  total[0] = 2;
  for (int i = 2; i <= n; ++i) {
    int sum = total[i - 1];
    for (int j = 1; j <= k; ++j) {
      if (a[i] == -1 || a[i] == j) {
        dp[i][j] = sum;
        length[i][j] = length[i - 1][j] + 1;
        if (i >= len && length[i][j] >= len) {
          dp[i][j] =
              ((dp[i][j] - (total[i - len] - dp[i - len][j])) % MOD + MOD) %
              MOD;
        }
      }
    }
    for (int j = 1; j <= k; ++j) total[i] = (total[i] + dp[i][j]) % MOD;
  }
  int res = 0;
  for (int i = 1; i <= k; ++i) res = (res + dp[n][i]) % MOD;
  std::cout << res << std::endl;
  return 0;
}
