#include <bits/stdc++.h>
using namespace std;
using INT = long long;
using pii = pair<int, int>;
int cnt[100100][110], ct[100100], a[100100], dp[100100][110], s[100100];
int power(int a, int b, int m, int ans = 1) {
  for (; b; b >>= 1, a = 1LL * a * a % m)
    if (b & 1) ans = 1LL * ans * a % m;
  return ans;
}
bool ok(int l, int r, int x) {
  int t = cnt[r][x] - cnt[l - 1][x];
  t += ct[r] - ct[l - 1];
  if (t == r - l + 1) return 1;
  return 0;
}
int main() {
  int n, k, len;
  cin >> n >> k >> len;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    for (int j = 1; j <= k; j++) cnt[i][j] = cnt[i - 1][j];
    ct[i] = ct[i - 1];
    if (a[i] != -1)
      cnt[i][a[i]]++;
    else
      ct[i]++;
  }
  s[0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      if (a[i] != -1 && j != a[i]) continue;
      if (i < len) {
        dp[i][j] = (dp[i][j] + s[i - 1]) % 998244353;
        continue;
      }
      if (!ok(i - len + 1, i - 1, j)) {
        dp[i][j] = (dp[i][j] + s[i - 1]) % 998244353;
        continue;
      }
      dp[i][j] =
          ((INT)dp[i][j] + s[i - 1] - s[i - len] + dp[i - len][j]) % 998244353;
      dp[i][j] = (dp[i][j] + 998244353) % 998244353;
    }
    for (int j = 1; j <= k; j++) s[i] = (s[i] + dp[i][j]) % 998244353;
  }
  int ans = s[n];
  cout << ans << endl;
  return 0;
}
