#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int ms = 112345;
const long long mod = 998244353;
int a[ms], pd[ms][101], sum[ms], occ[ms][101];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, k, len;
  cin >> n >> k >> len;
  if (len == 1) {
    cout << 0 << '\n';
    return 0;
  }
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int i = 0; i < n; ++i) {
    for (int val = 1; val <= k; ++val) {
      occ[i][val] = a[i] == -1 || a[i] == val;
      if (i && occ[i][val]) {
        occ[i][val] += occ[i - 1][val];
      }
    }
  }
  for (int val = 1; val <= k; ++val) {
    pd[0][val] = a[0] == -1 || a[0] == val;
    sum[0] += pd[0][val];
  }
  for (int i = 1; i < n; ++i) {
    for (int val = 1; val <= k; ++val) {
      if (a[i] != -1 && a[i] != val) {
        continue;
      }
      pd[i][val] = sum[i - 1];
      if (i - len >= 0 && occ[i - 1][val] >= len - 1) {
        pd[i][val] =
            ((long long)sum[i - 1] - sum[i - len] + pd[i - len][val]) % mod;
      } else if (i - len == -1 && occ[i - 1][val] >= len - 1) {
        --pd[i][val];
      }
      sum[i] = (sum[i] + pd[i][val]) % mod;
    }
  }
  cout << (sum[n - 1] + mod) % mod << '\n';
  return 0;
}
