#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
const int mod = 998244353;
long long dp[maxn][105];
long long sum[maxn];
int a[maxn];
int b[maxn][105];
int main() {
  int n, k, len;
  scanf("%d%d%d", &n, &k, &len);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    if (a[i] != -1) {
      b[i][a[i]] = 1;
    } else {
      b[i][k + 1] = 1;
    }
    for (int j = 1; j <= k + 1; j++) {
      b[i][j] += b[i - 1][j];
    }
  }
  sum[0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      if (a[i] == -1 || a[i] == j) {
        dp[i][j] = sum[i - 1];
        if (i >= len && (b[i][j] - b[i - len][j] + b[i][k + 1] -
                         b[i - len][k + 1]) == len) {
          dp[i][j] -= sum[i - len] - dp[i - len][j];
          while (dp[i][j] < 0) dp[i][j] += mod;
          dp[i][j] %= mod;
        }
      }
      sum[i] += dp[i][j];
      if (sum[i] >= mod) sum[i] -= mod;
    }
  }
  printf("%lld\n", sum[n]);
}
