#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e5 + 100;
const long long mod = 998244353;
const long long base = 500;
long long a[maxn];
long long f[maxn][120];
long long dp[maxn][120];
long long dp1[maxn];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  if (fopen("ginger.INP", "r")) {
    freopen("ginger.INP", "r", stdin);
    freopen("ginger.OUT", "w", stdout);
  }
  long long n, k, len;
  cin >> n >> k >> len;
  if (len == 1) {
    cout << 0;
    return 0;
  }
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      f[i][j] = f[i - 1][j];
      if (a[i] == j || a[i] == -1) {
        f[i][j]++;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      if (a[i] != j && a[i] != -1) continue;
      if (i == 1) {
        dp[i][j] = 1;
      } else {
        dp[i][j] = dp1[i - 1];
      }
      if (i >= len && f[i][j] - f[i - len][j] == len) {
        if (i == len) {
          dp[i][j] = (dp[i][j] - 1 + mod) % mod;
        } else {
          dp[i][j] = (dp[i][j] + dp[i - len][j] - dp1[i - len] + mod) % mod;
        }
      }
      dp1[i] += dp[i][j];
      dp1[i] %= mod;
    }
  }
  cout << dp1[n];
}
