#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
const int maxn = 100010, maxk = 110;
int n, K, len;
long long dp[maxn][maxk];
int cnt[maxn][maxk], a[maxn];
long long sum[maxn];
int main() {
  scanf("%d%d%d", &n, &K, &len);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    for (int k = 1; k <= K; k++) {
      if (a[i] == k || a[i] == -1) {
        cnt[i][k] = cnt[i - 1][k] + 1;
      }
    }
  }
  sum[0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int k = 1; k <= K; k++) {
      if (a[i] != k && a[i] != -1) {
        continue;
      }
      dp[i][k] = sum[i - 1];
      int s = max(1, i - len + 1);
      if (cnt[i][k] - cnt[s - 1][k] == len) {
        dp[i][k] -= sum[s - 1] - dp[s - 1][k];
        dp[i][k] = (dp[i][k] % mod + mod) % mod;
      }
    }
    for (int k = 1; k <= K; k++) {
      sum[i] += dp[i][k];
      sum[i] %= mod;
    }
  }
  cout << sum[n] << endl;
}
