#include <bits/stdc++.h>
using namespace std;
const int N = 998244353;
int add(const int &x, const int &y) { return (x + y) % N; }
int sub(const int &x, const int &y) { return (x + N - y) % N; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, k, len;
  cin >> n >> k >> len;
  vector<int> a(n + 1);
  for (int i = 1; i <= n; ++i) cin >> a[i];
  vector<vector<int>> dp(n + 1, vector<int>(k + 1, 0));
  vector<int> check(k + 1, 0);
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; ++j)
      check[j] = (a[i] == -1 || a[i] == j) ? check[j] + 1 : 0;
    int x = (a[i] != -1) ? a[i] : 1, y = (a[i] != -1) ? a[i] : k;
    for (int j = x; j <= y; ++j) {
      dp[i][j] = (i) ? dp[i - 1][0] : 1;
      if (check[j] >= len)
        dp[i][j] = sub(dp[i][j], sub(dp[i - len][0], dp[i - len][j]));
      dp[i][0] = add(dp[i][0], dp[i][j]);
    }
  }
  cout << dp[n][0];
  return 0;
}
