#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5, K = 105, mod = 998244353;
int n, k, len, a[N], f[N][105], g[N], ans[N], cnt[N];
int main() {
  while (~scanf("%d%d%d", &n, &k, &len)) {
    for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
    if (len < 2) {
      puts("0");
      continue;
    }
    g[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] - g[j] + mod) % mod;
          if (++cnt[j] >= len - 1)
            g[j] = (ans[i - len + 1] - f[i - len + 1][j] + mod) % mod;
        } else
          cnt[j] = g[j] = 0;
        ans[i] = (ans[i] + f[i][j]) % mod;
      }
    }
    printf("%d\n", ans[n]);
  }
}
