#include <bits/stdc++.h>
using namespace std;
const int mx = (int)1e5 + 5;
const long long mo = 998244353;
int a[mx], cnt[mx][105];
long long d[mx][105], sum[mx];
int main() {
  int n, k, len;
  cin >> n >> k >> len;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++)
      cnt[i][j] = cnt[i - 1][j] + (a[i] == j || a[i] == -1);
  }
  sum[0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      if (a[i] == -1 || a[i] == j) {
        d[i][j] = sum[i - 1];
        if (i >= len && cnt[i][j] - cnt[i - len][j] == len)
          d[i][j] = ((d[i][j] - (sum[i - len] - d[i - len][j] + 2 * mo) % mo) +
                     2 * mo) %
                    mo;
        sum[i] += d[i][j];
        sum[i] %= mo;
      }
    }
  }
  cout << sum[n] << endl;
  return 0;
}
