#include <bits/stdc++.h>
using namespace std;
const long long INFll = 1ll * 1000000009 * 1000000009;
long long a[100005];
long long dp[100005][105], sdp[100005];
int main() {
  int n, k, len;
  cin >> n >> k >> len;
  for (int i = 1; i <= n; i++) cin >> a[i];
  sdp[0] = 1;
  vector<int> cnt(k + 1, 0);
  for (int i = 1; i < len; i++) {
    cnt[max(0ll, a[i])]++;
    for (int j = 1; j <= k; j++) {
      if (a[i] == -1 || a[i] == j) dp[i][j] = sdp[i - 1];
      sdp[i] += dp[i][j];
      sdp[i] %= 998244353;
    }
  }
  for (int i = len; i <= n; i++) {
    cnt[max(0ll, a[i])]++;
    for (int j = 1; j <= k; j++) {
      if (a[i] == -1 || a[i] == j) dp[i][j] = sdp[i - 1];
      if (cnt[0] + cnt[j] == len) dp[i][j] -= sdp[i - len] - dp[i - len][j];
      dp[i][j] %= 998244353;
      if (dp[i][j] < 0) dp[i][j] += 998244353;
      sdp[i] += dp[i][j];
      sdp[i] %= 998244353;
    }
    cnt[max(0ll, a[i - len + 1])]--;
  }
  cout << sdp[n] << endl;
}
