#include <bits/stdc++.h>
using namespace std;
long long func(long long, long long), cr[100005], dp[100005][105];
long long n, k, len, cont, var, ar[100005], tr[100005];
int main() {
  cin >> n >> k >> len;
  for (int i = 1; i < n + 1; i++) {
    cin >> ar[i];
    if (ar[i] == -1)
      cr[i] = (1 + cr[i - 1]);
    else
      cr[i] = 0;
  }
  tr[0] = 1;
  for (int i = 1; i < n + 1; i++) {
    if (cr[i] >= len || cr[i] == i) var = -1;
    if (ar[i] == -1) {
      cont++;
      for (int j = 1; j < k + 1; j++) {
        dp[i][j] = tr[i - 1];
        if ((var == j || var == -1) && cont >= len) {
          dp[i][j] = (dp[i][j] - func(i, j) + 998244353ll) % 998244353ll;
        }
      }
    } else {
      if (ar[i] == var || var == -1) {
        cont++;
        var = ar[i];
      } else {
        cont = 1 + cr[i - 1];
        var = ar[i];
      }
      dp[i][ar[i]] = tr[i - 1];
      if (cont >= len) {
        dp[i][ar[i]] =
            (dp[i][ar[i]] - func(i, ar[i]) + 998244353ll) % 998244353ll;
      }
    }
    for (int j = 1; j < k + 1; j++) tr[i] = (tr[i] + dp[i][j]) % 998244353ll;
  }
  long long ans = 0;
  for (int i = 1; i < k + 1; i++) {
    ans = (ans + dp[n][i]) % 998244353ll;
  }
  cout << ans << "\n";
}
long long func(long long idx, long long num) {
  if (idx < len) return 0;
  return (tr[idx - len] - dp[idx - len][num] + 998244353ll) % 998244353ll;
}
