#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int _inf = 0xc0c0c0c0;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const long long _INF = 0xc0c0c0c0c0c0c0c0;
const long long mod = 998244353;
const int N = 1e5 + 100;
long long dp[N][105];
long long tot[N];
int num[105][N];
int a[N];
int n, k, len;
int check(int l, int r, int id) {
  if (l > r) return false;
  if (l <= 0) return false;
  int ok = num[id][r] - num[id][l - 1] + num[0][r] - num[0][l - 1];
  if (ok == len - 1) return true;
  return false;
}
int main() {
  scanf("%d%d%d", &n, &k, &len);
  if (len == 1) {
    cout << 0 << endl;
    return 0;
  }
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
    if (a[i] == -1) a[i] = 0;
  }
  for (int j = 0; j <= k; ++j)
    for (int i = 1; i <= n; ++i) num[j][i] = num[j][i - 1] + (a[i] == j);
  tot[0] = 1;
  for (int i = 1; i <= n; ++i) {
    if (a[i] == 0) {
      for (int j = 1; j <= k; ++j) {
        dp[i][j] = tot[i - 1];
        if (check(i - len + 1, i - 1, j) && a[i - len] != j) {
          dp[i][j] -= tot[i - len] - dp[i - len][j];
          while (dp[i][j] < 0) dp[i][j] += mod;
          while (dp[i][j] >= mod) dp[i][j] -= mod;
        }
      }
    } else {
      dp[i][a[i]] = tot[i - 1];
      if (check(i - len + 1, i - 1, a[i]) && a[i - len] != a[i]) {
        dp[i][a[i]] -= tot[i - len] - dp[i - len][a[i]];
        while (dp[i][a[i]] < 0) dp[i][a[i]] += mod;
        while (dp[i][a[i]] >= mod) dp[i][a[i]] -= mod;
      }
    }
    for (int j = 1; j <= k; ++j) {
      tot[i] += dp[i][j];
      tot[i] = (tot[i] % mod + mod) % mod;
    }
  }
  cout << tot[n] << endl;
  return 0;
}
