#include <bits/stdc++.h>
using namespace std;
const int MOD = 998244353;
const int N = 100010;
int a[N];
bool cont[110][N];
long long f[N][110], sumf[N];
int main() {
  ios::sync_with_stdio(false);
  int n, k, len;
  cin >> n >> k >> len;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int j = 1; j <= k; j++) {
    int cnt = 0;
    for (int i = 1; i <= n; i++) {
      if (a[i] == -1 || a[i] == j)
        cnt++;
      else
        cnt = 0;
      if (cnt >= len) cont[j][i] = true;
    }
  }
  f[0][0] = 1;
  sumf[0] = 1;
  for (int i = 1; i <= n; i++) {
    if (a[i] == -1)
      for (int j = 1; j <= k; j++) {
        f[i][j] = sumf[i - 1];
        if (cont[j][i]) f[i][j] -= sumf[i - len] - f[i - len][j];
        sumf[i] = (sumf[i] + f[i][j]) % MOD;
      }
    else {
      f[i][a[i]] = sumf[i - 1];
      if (cont[a[i]][i]) f[i][a[i]] -= sumf[i - len] - f[i - len][a[i]];
      sumf[i] = (sumf[i] + f[i][a[i]]) % MOD;
    }
  }
  cout << (sumf[n] + MOD) % MOD << "\n";
}
