#include <bits/stdc++.h>
using namespace std;
int N, K, len;
int a[100005];
int s[105][100005];
long long dp[100005][105];
long long ans[100005];
int main() {
  ios::sync_with_stdio(0);
  cin >> N >> K >> len;
  for (int i = 1; i <= N; i++) {
    for (int j = 0; j <= K; j++) s[j][i] = s[j][i - 1];
    cin >> a[i];
    if (a[i] == -1)
      s[0][i]++;
    else
      s[a[i]][i]++;
  }
  ans[0] = 1;
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= K; j++) {
      if (a[i] != -1 && a[i] != j) continue;
      dp[i][j] = ans[i - 1];
      if (i - len >= 0 &&
          (s[0][i] - s[0][i - len]) + (s[j][i] - s[j][i - len]) == len)
        dp[i][j] = (dp[i][j] - ans[i - len] + dp[i - len][j] + int(998244353)) %
                   int(998244353);
      ans[i] = (ans[i] + dp[i][j]) % int(998244353);
    }
  }
  cout << ans[N] << endl;
  return 0;
}
