#include <bits/stdc++.h>
using namespace std;
const int N = 110000, M = 110, mod = 998244353;
int n, K, m, a[N], las[M];
long long f[N][M], s[N][M], g[N], ans;
int main() {
  scanf("%d%d%d", &n, &K, &m);
  --m;
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  g[0] = 1;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= K; ++j) {
      s[i][j] = s[i - 1][j];
      if (j != a[i] && a[i] != -1) {
        las[j] = i;
        continue;
      }
      las[j] = max(las[j], i - m);
      if (las[j])
        f[i][j] = (f[i][j] + g[i - 1] + mod - g[las[j] - 1] - s[i - 1][j] +
                   mod + s[las[j] - 1][j]) %
                  mod;
      else
        f[i][j] = (f[i][j] + g[i - 1] + mod - s[i - 1][j]) % mod;
      s[i][j] = (s[i][j] + f[i][j]) % mod;
      g[i] = (g[i] + f[i][j]) % mod;
    }
    g[i] = (g[i - 1] + g[i]) % mod;
  }
  for (int i = 1; i <= K; ++i) ans = (ans + f[n][i]) % mod;
  printf("%lld", ans);
  return 0;
}
