#include using namespace std; using LL=long long; using ULL=unsigned long long; #define rep(i,n) for(int i=0;i<(n);i++) const int Z=1024; LL N; int K,X,Y; int A[Z]={}; ULL dp[Z][Z]={}; ULL buf[Z][Z]={}; int main(){ scanf("%d%d%d%d",&N,&K,&X,&Y); if(K == 1 && N >= 2){ printf("0\n"); return 0; } rep(i,K){ int a; scanf("%d",&a); A[a]=dp[a][a]=1; } rep(i,N-1){ rep(x,Z){ ULL S=0; rep(y,Z) S+=dp[x][y]; rep(y,Z) if(A[y]) buf[x^y][y] = S-dp[x][y]; } rep(x,Z) rep(y,Z){ dp[x][y]=buf[x][y]; buf[x][y]=0; } } ULL ans=0; rep(x,Z) rep(y,Z) if(X<=x && x<=Y) ans+=dp[x][y]; printf("%lld\n",ans%998244353); return 0; }