#include <bits/stdc++.h>   using namespace std;   inline void read(long long &x) {     char ch;     bool flag = false;     for (ch = getchar(); !isdigit(ch); ch = getchar())       if (ch ==  - ) flag = true;     for (x = 0; isdigit(ch); x = x * 10 + ch -  0 , ch = getchar())       ;     x = flag ? -x : x;   }   inline void write(long long x) {     static const long long maxlen = 100;     static char s[maxlen];     if (x < 0) {       putchar( - );       x = -x;     }     if (!x) {       putchar( 0 );       return;     }     long long len = 0;     for (; x; x /= 10) s[len++] = x % 10 +  0 ;     for (long long i = len - 1; i >= 0; --i) putchar(s[i]);   }   inline void read(int &x) {     char ch;     bool flag = false;     for (ch = getchar(); !isdigit(ch); ch = getchar())       if (ch ==  - ) flag = true;     for (x = 0; isdigit(ch); x = x * 10 + ch -  0 , ch = getchar())       ;     x = flag ? -x : x;   }   const long long MAXN = 110000;   long long f[MAXN][110];   long long s[MAXN];   const long long P = 998244353ll;   long long n, lim, kind;   long long a[MAXN];   long long num[MAXN][110];   int main() {     read(n);     read(kind);     read(lim);     for (long long i = 1; i <= n; i++) {       read(a[i]);       if (a[i] == -1) a[i] = 0;     }     for (long long i = 1; i <= n; i++) {       for (long long j = 0; j <= kind; j++) num[i][j] = num[i - 1][j];       num[i][a[i]]++;     }     s[0] = 1;     for (long long i = 1; i <= n; i++)       if (a[i] == 0)         for (long long j = 1; j <= kind; j++) {           f[i][j] = s[i - 1];           if ((i >= lim) &&               (num[i][j] - num[i - lim][j] + num[i][0] - num[i - lim][0] == lim))             f[i][j] = (f[i][j] - (s[i - lim] - f[i - lim][j]) + 3 * P) % P;           s[i] = (s[i] + f[i][j]) % P;         }       else {         long long j = a[i];         f[i][a[i]] = s[i - 1];         if ((i >= lim) &&             (num[i][j] - num[i - lim][j] + num[i][0] - num[i - lim][0] == lim)) {           f[i][j] = (f[i][j] - (s[i - lim] - f[i - lim][j])) % P;         }         s[i] = (s[i] + f[i][j]) % P;       }     cout << s[n] << endl;     return 0;     for (;;) {       long long x, y;       read(x);       read(y);       printf( f[%d][%d]=%d n , x, y, f[x][y]);     }     return 0;   }   