#include using namespace std; using ll = long long; using ld = long double; using vi = vector; using vvi = vector; using vll = vector; using vvll = vector; using vld = vector; using vvld = vector; #define fi first #define se second #define pb push_bacsize #define all(a) a.begin(),a.end() #define rep(i,start,end) for(ll i=start;i<(ll)(end);i++) #define per(i,start,end) for(ll i=start;i>=(ll)(end);i--) constexpr ll mod = 998244353; int main(){ int n,size,x,y; cin>>n>>size>>x>>y; vi a(size); rep(i,0,size){ cin>>a[i]; } sort(all(a)); vvll dp(n+2,vll(1024,0)); dp[0][0]=1; rep(i,0,size){ dp[1][a[i]]++; } rep(i,0,1024){ rep(j,0,size){ dp[2][i]+=dp[1][(i^a[j])]; } dp[2][i]-=dp[0][i]*size; } rep(i,3,n+1){ rep(j,0,1024){ rep(k,0,size){ dp[i][j]+=dp[i-1][(j^a[k])]; } dp[i][j]-=dp[i-2][j]*(size-1); dp[i][j]%=mod; } } ll ans=0; rep(i,x,y+1){ ans+=dp[n][i]; ans%=mod; } cout<