#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010, inf = 1e9 + 233, mod = 998244353;
int n, K, len, x;
int f[maxn][110], sum[maxn][110], pre[maxn], sum2[maxn];
template <typename T>
inline void read(T &k) {
  int f = 1;
  k = 0;
  char c = getchar();
  while (c < '0' || c > '9') c == '-' && (f = -1), c = getchar();
  while (c <= '9' && c >= '0') k = k * 10 + c - '0', c = getchar();
  k *= f;
}
int main() {
  read(n);
  read(K);
  read(len);
  f[1][0] = 1;
  sum[1][0] = sum2[1] = 1;
  for (int i = 2; i <= n + 1; i++) {
    read(x);
    if (x == -1) {
      for (int j = 1; j <= K; j++) {
        f[i][j] =
            ((sum2[i - 1] - sum2[max(pre[j], i - len)] + mod) >= mod
                 ? ((sum2[i - 1] - sum2[max(pre[j], i - len)] + mod) - mod)
                 : (sum2[i - 1] - sum2[max(pre[j], i - len)] + mod));
        int delta =
            ((sum[i - 1][j] - sum[max(pre[j], i - len)][j] + mod) >= mod
                 ? ((sum[i - 1][j] - sum[max(pre[j], i - len)][j] + mod) - mod)
                 : (sum[i - 1][j] - sum[max(pre[j], i - len)][j] + mod));
        f[i][j] =
            ((f[i][j] - delta + mod) >= mod ? ((f[i][j] - delta + mod) - mod)
                                            : (f[i][j] - delta + mod));
      }
    } else {
      int zy = max(pre[x], i - len);
      for (int j = 0; j <= K; j++)
        if (j != x) {
          int delta = ((sum[i - 1][j] - sum[zy][j] + mod) >= mod
                           ? ((sum[i - 1][j] - sum[zy][j] + mod) - mod)
                           : (sum[i - 1][j] - sum[zy][j] + mod));
          f[i][x] = ((f[i][x] + delta) >= mod ? ((f[i][x] + delta) - mod)
                                              : (f[i][x] + delta));
          pre[j] = i - 1;
        }
    }
    for (int j = 0; j <= K; j++)
      sum[i][j] =
          ((sum[i - 1][j] + f[i][j]) >= mod ? ((sum[i - 1][j] + f[i][j]) - mod)
                                            : (sum[i - 1][j] + f[i][j])),
      sum2[i] = ((sum2[i] + sum[i][j]) >= mod ? ((sum2[i] + sum[i][j]) - mod)
                                              : (sum2[i] + sum[i][j]));
  }
  int ans = 0;
  for (int i = 1; i <= K; i++)
    ans = ((ans + f[n + 1][i]) >= mod ? ((ans + f[n + 1][i]) - mod)
                                      : (ans + f[n + 1][i]));
  printf("%d\n", ans);
}
