#include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &item) {
  out << '(' << item.first << ", " << item.second << ')';
  return out;
}
template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  for (const auto &item : v) out << item << ' ';
  return out;
}
struct Num {
  int x;
  Num(int x = 0) : x(x) {}
  Num &operator+=(const Num &a) {
    if ((x += a.x) >= 998244353) x -= 998244353;
  }
  Num &operator-=(const Num &a) {
    if ((x -= a.x) < 0) x += 998244353;
  }
  friend Num operator+(const Num &a, const Num &b) {
    return Num(a.x + b.x >= 998244353 ? a.x + b.x - 998244353 : a.x + b.x);
  }
  friend Num operator-(const Num &a, const Num &b) {
    return Num(a.x < b.x ? a.x - b.x + 998244353 : a.x - b.x);
  }
  operator int() { return x; }
};
int a[100010], last[110];
Num dp[100010][110], sumLin[100010][110], sumCol[100010], s[100010];
Num getS(int i, int j) {
  if (i <= 0) return s[j];
  return s[j] - s[i - 1];
}
Num getSumLin(int i, int j, int k) {
  if (i <= 0) return sumLin[j][k];
  return sumLin[j][k] - sumLin[i - 1][k];
}
int main() {
  ios_base::sync_with_stdio(false);
  int i, j, n, k, len, nr;
  Num ans;
  cin >> n >> k >> len;
  for (i = 1; i <= n; ++i) cin >> a[i];
  for (i = 1; i <= n; s[i] = s[i - 1] + sumCol[i], ++i)
    for (j = 1; j <= k; ++j) {
      if (a[i] != j && a[i] != -1) last[j] = i;
      nr = min(i, min(len - 1, i - last[j]));
      if (nr == i) dp[i][j] = 1, --nr;
      if (nr > 0) {
        dp[i][j] += getS(i - nr, i - 1) - getSumLin(i - nr, i - 1, j);
      }
      sumLin[i][j] = sumLin[i - 1][j] + dp[i][j];
      sumCol[i] += dp[i][j];
    }
  ans = accumulate(dp[n] + 1, dp[n] + 1 + k, Num(0));
  cout << ans << '\n';
  return 0;
}
