#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target( \
    "avx,avx2,fma,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
long long MOD = 998244353;
long long INF = 1e18;
const int N = 100001;
long long dp[N][101];
long long sm[N];
long long cnt[N][101];
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0),
      cout << fixed << setprecision(20);
  long long n, k, len;
  cin >> n >> k >> len;
  if (len == 1) {
    cout << 0;
    return 0;
  }
  vector<long long> a(n + 1);
  sm[0] = 1;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    for (int j = 1; j <= k; j++) {
      cnt[i][j] = cnt[i - 1][j] + (a[i] == -1 || a[i] == j);
      if (a[i] != -1 && j != a[i]) {
        cnt[i][j] = 0;
      }
    }
    if (a[i] != -1) {
      dp[i][a[i]] += sm[i - 1];
      if (cnt[i][a[i]] >= len) dp[i][a[i]] -= sm[i - len] - dp[i - len][a[i]];
    } else {
      for (int j = 1; j <= k; j++) {
        dp[i][j] += sm[i - 1];
        if (cnt[i][j] >= len) dp[i][j] -= sm[i - len] - dp[i - len][j];
      }
    }
    for (int j = 1; j <= k; j++) {
      dp[i][j] %= MOD;
      dp[i][j] += MOD;
      dp[i][j] %= MOD;
      sm[i] += dp[i][j];
      sm[i] %= MOD;
    }
  }
  cout << sm[n];
}
