#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 10;
const long long K = 105;
const long long MOD = 998244353;
long long n, k, len;
long long dp[N][K];
long long achi[N];
long long a[N];
void fill(long long i, long long j) {
  if (achi[i - 1] < 0 || achi[i - 1] == j) {
    dp[i][j] = dp[i - 1][0] - dp[i - len][0] + dp[i - len][j];
  } else {
    dp[i][j] = dp[i - 1][0];
  }
  dp[i][j] %= MOD;
  if (dp[i][j] < 0) dp[i][j] += MOD;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k >> len;
  if (len == 1) {
    cout << 0 << '\n';
    return 0;
  }
  map<long long, long long> tab;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
    auto it = tab.find(a[i]);
    if (it == tab.end())
      tab.insert(make_pair(a[i], 1));
    else
      it->second++;
    if (i > len - 1) {
      it = tab.find(a[i - len + 1]);
      if (it->second-- == 1) tab.erase(it);
    }
    if (i < len - 1) continue;
    if (tab.size() == 1) achi[i] = tab.begin()->first;
    if (tab.size() == 2 && tab.begin()->first == -1) {
      achi[i] = (++tab.begin())->first;
    }
  }
  dp[0][0] = 1;
  for (long long i = 1; i <= n; i++) {
    if (a[i] > 0) {
      fill(i, a[i]);
      dp[i][0] = dp[i][a[i]];
    } else {
      for (long long j = 1; j <= k; j++) {
        fill(i, j);
        dp[i][0] = (dp[i][0] + dp[i][j]) % MOD;
      }
    }
  }
  cout << dp[n][0] << '\n';
  return 0;
}
