#include <bits/stdc++.h>
namespace shl {
inline int read() {
  int ret = 0, op = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') op = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    ret = ret * 10 + c - '0';
    c = getchar();
  }
  return ret * op;
}
const int N = 1e5 + 10;
const long long mod = 998244353;
int n, m, k;
int a[N];
long long f[N][110], ans[N], fail[N], num[N];
int main() {
  n = read(), k = read(), m = read();
  for (int i = 1; i <= n; ++i) a[i] = read();
  if (m == 1) {
    puts("0");
    exit(0);
  }
  ans[0] = 1;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= k; ++j) {
      if (a[i] == j || a[i] == -1) {
        f[i][j] = (ans[i - 1] - fail[j] + mod) % mod;
        num[j]++;
        if (num[j] >= m - 1)
          fail[j] = (ans[i - m + 1] - f[i - m + 1][j] + mod) % mod;
        ans[i] = (ans[i] + f[i][j]) % mod;
      } else {
        fail[j] = num[j] = 0;
      }
    }
  }
  printf("%lld\n", ans[n]);
  return 0;
}
}  // namespace shl
int main() {
  shl::main();
  return 0;
}
