#include<bits/stdc++.h>
using namespace std;
long long n,l,r,t,a[1000005],ans,f[1000005];
int main(){
freopen("cirnoisclever.in","r",stdin);
freopen("cirnoisclever.out","w",stdout);
scanf("%lld%lld%lld%lld",&n,&l,&r,&t);
for (int i=1;i<=n;i++){
scanf("%d",&a[i]);
}
if (!t&&a[1]!=a[n]){
printf("0");
return 0;
}
f[1]=1;
for (int i=1;i<=n;i++){
for (int j=i+l;j<=i+r;j++){
if (abs(a[j]-a[i])<=t){
f[j]+=f[i];
f[j]%=998244353;
}
}
}
cout<<f[n];
return 0;
}