#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 20;
const int maxk = 1e2 + 20;
const int mod = 998244353;
int n, k, dp[maxn][maxk], sum[maxn], a[maxn], last[maxn];
inline void mkay(int &a) {
  if (a >= mod)
    a -= mod;
  else if (a < 0)
    a += mod;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, k, len;
  cin >> n >> k >> len;
  for (int i = 1; i <= n; i++) cin >> a[i];
  multiset<int> st;
  sum[0] = 1;
  for (int i = 1; i <= n; i++) {
    if (a[i] != -1) st.insert(a[i]);
    if (i > len && a[i - len] != -1) st.erase(st.find(a[i - len]));
    for (int j = 1; j <= k; j++) {
      if (a[i] == -1) {
        dp[i][j] = sum[i - 1];
        if (st.empty() && i >= len)
          mkay(dp[i][j] -= sum[i - len]), mkay(dp[i][j] += dp[i - len][j]);
        else if (*st.begin() == *st.rbegin() && *st.begin() == j && i >= len)
          mkay(dp[i][j] -= sum[i - len]), mkay(dp[i][j] += dp[i - len][j]);
      } else if (j == a[i]) {
        dp[i][j] = sum[i - 1];
        if (*st.begin() == *st.rbegin() && i >= len)
          mkay(dp[i][j] -= sum[i - len]), mkay(dp[i][j] += dp[i - len][j]);
      }
      mkay(sum[i] += dp[i][j]);
    }
  }
  cout << sum[n] << endl;
}
