#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10, K = 105, MOD = 998244353;
int p[N][K], dp[N][K], a[N], ans[N] = {1};
int n, k, len;
int sum(int l, int r, int x) {
  l = max(l, 1);
  r = min(r, n);
  return p[r][x] - p[l - 1][x];
}
int main() {
  cin >> n >> k >> len;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    if (a[i] == -1) a[i]++;
    p[i][a[i]]++;
    for (int j = 0; j <= k; j++) {
      p[i][j] += p[i - 1][j];
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      if (a[i] == 0 || a[i] == j) {
        dp[i][j] = ans[i - 1];
        if (sum(i - len + 1, i, j) + sum(i - len + 1, i, 0) == len) {
          dp[i][j] -= ans[i - len] - dp[i - len][j];
          if (dp[i][j] < 0) dp[i][j] += MOD;
          if (dp[i][j] >= MOD) dp[i][j] -= MOD;
        }
      }
    }
    for (int j = 1; j <= k; j++) {
      ans[i] += dp[i][j];
      if (ans[i] >= MOD) ans[i] -= MOD;
    }
  }
  cout << ans[n] << '\n';
}
