#include <bits/stdc++.h>
using namespace std;
const long double eps = 1e-13;
const long double PI = acos(-1);
const int INF = (int)1e9;
const long long INFF = (long long)1e18;
const int mod = 998244353;
const int MXN = (int)1e5 + 7;
int a[MXN];
int dp[MXN][107];
int lsum[MXN][107];
int main() {
  int n, m, k;
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  if (k == 1) {
    puts("0");
    return 0;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      lsum[i][j] = lsum[i - 1][j];
      if (a[i] == -1 || a[i] == j) lsum[i][j]++;
    }
  }
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    int st = 1, ed = m;
    if (a[i] != -1) {
      st = ed = a[i];
    }
    for (int j = st; j <= ed; j++) {
      dp[i][j] = dp[i - 1][0];
      int ll = i - k;
      if (ll >= 0 && lsum[i][j] - lsum[ll][j] == k) {
        int v = (dp[ll][0] - dp[ll][j] + mod) % mod;
        dp[i][j] = (dp[i][j] - v + mod) % mod;
      }
      dp[i][0] = (dp[i][0] + dp[i][j]) % mod;
    }
  }
  printf("%d\n", dp[n][0]);
  return 0;
}
