#include #define rep(i,n) for(int i=0;i<(int)(n);i++) #define chmin(x,y) x = min((x),(y)); #define chmax(x,y) x = max((x),(y)); using namespace std; using ll = long long ; using P = pair ; using pll = pair; const int INF = 1e9; const long long LINF = 1e17; //const int MOD = 1000000007; const int MOD = 998244353; const double PI = 3.14159265358979323846; template struct ModInt{ long long x=0; constexpr ModInt(long long x=0):x((x%mod+mod)%mod){} constexpr ModInt operator+(const ModInt& r)const{return ModInt(*this)+=r;} constexpr ModInt operator-(const ModInt& r)const{return ModInt(*this)-=r;} constexpr ModInt operator*(const ModInt& r)const{return ModInt(*this)*=r;} constexpr ModInt operator/(const ModInt& r)const{return ModInt(*this)/=r;} constexpr ModInt& operator+=(const ModInt& r){ if((x+=r.x)>=mod) x-=mod; return *this;} constexpr ModInt& operator-=(const ModInt& r){ if((x-=r.x)<0) x+=mod; return *this;} constexpr ModInt& operator*=(const ModInt& r){ if((x*=r.x)>=mod) x%=mod; return *this;} constexpr ModInt& operator/=(const ModInt& r){ return *this*=r.inv();} ModInt inv() const { long long s=x,sx=1,sy=0,t=mod,tx=0,ty=1; while(s%t!=0){ long long temp=s/t,u=s-t*temp,ux=sx-temp*tx,uy=sy-temp*ty; s=t;sx=tx;sy=ty; t=u;tx=ux;ty=uy; } return ModInt(tx); } ModInt pow(long long n) const { ModInt a=1; ModInt b=*this; while(n>0){ if(n&1) a*=b; b*=b; n>>=1; } return a; } friend constexpr ostream& operator<<(ostream& os,const ModInt& a) {return os << a.x;} friend constexpr istream& operator>>(istream& is,ModInt& a) {return is >> a.x;} }; using mint = ModInt; mint dp[42][1025][1025]; mint a[2000]; int main(){ int n,k; cin >> n >> k; ll x,y; cin >> x >> y; rep(i,k){ int b; cin >> b; a[b] += mint(1); } vector dpp(1024,0); for(int i=0;i<1024;i++){ for(int j=0;j<1024;j++){ if(i == j) continue; dp[1][i^j][j] = a[i] * a[j]; dpp[i^j] += a[i] * a[j]; } } for(int i=1;i new_dpp(1024,0); for(int j=0;j<1024;j++){ for(int k=0;k<1024;k++){ dp[i+1][k][j^k] += (dpp[j] - dp[i][j][j^k]) * a[j^k]; new_dpp[k] += (dpp[j] - dp[i][j][j^k]) * a[j^k]; } } swap(new_dpp,dpp); } mint ans = 0; for(ll i=x;i<=min(y,1024LL);i++){ for(int j=0;j<1024;j++) ans += dp[n-1][i][j]; } cout << ans << endl; return 0; }