//* #pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") //*/ #include // #include using namespace std; // using namespace atcoder; #define DEBUG(x) cerr<<#x<<": "< #define vl vector #define vii vector< vector > #define vll vector< vector > #define vs vector #define pii pair #define pis pair #define psi pair #define pll pair template pair operator+(const pair &s, const pair &t) { return pair(s.first + t.first, s.second + t.second); } template pair operator-(const pair &s, const pair &t) { return pair(s.first - t.first, s.second - t.second); } template ostream& operator<<(ostream& os, pair p) { os << "(" << p.first << ", " << p.second << ")"; return os; } #define X first #define Y second #define rep(i,n) for(int i=0;i<(int)(n);i++) #define rep1(i,n) for(int i=1;i<=(int)(n);i++) #define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--) #define rrep1(i,n) for(int i=(int)(n);i>0;i--) #define REP(i,a,b) for(int i=a;i bool chmax(T &a, const T &b) { if (a bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; } #define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end()); const ll inf = 1000000001; const ll INF = (ll)1e18 + 1; const long double pi = 3.1415926535897932384626433832795028841971L; #define Sp(p) cout<= 0; i--) { rfact[i] = (i + 1) * rfact[i + 1] % M; } } //http://drken1215.hatenablog.com/entry/2018/06/08/210000 //n���傫��fact���v�Z�ł��Ȃ��Ƃ��̂ق��̌v�Z���@�ɂ‚��ď����Ă��� ll nCr(ll n, ll r, ll M = MOD) { if (r > n) return 0; assert(fact[2] == 2); ll ret = fact[n]; if (rfact[r] == 0) { rfact[r] = mod_inverse(fact[r], M); } ret = (ret*rfact[r]) % M; if (rfact[n - r] == 0) { rfact[n - r] = mod_inverse(fact[n - r], M); } ret = (ret*rfact[n - r]) % M; return ret; } ll nHr(ll n, ll r) { return nCr(n+r-1, r); } const int m = 1024; vi a; void dfs(vl& path, int n, vll& dp) { if (path.size() == n) { ll x = 0; for (int idx: path) x ^= a[idx]; dp[path.back()][x]++; return; } rep (i, a.size()) { if (path.size() > 0 and path.back() == i) continue; path.push_back(i); dfs(path, n, dp); path.pop_back(); } } template void fwt(vector& f) { int n = f.size(); for (int i = 1; i < n; i <<= 1) { for (int j = 0; j < n; j++) { if ((j & i) == 0) { T x = f[j], y = f[j | i]; f[j] = (x + y) % MOD, f[j | i] = (x - y) % MOD; } } } } ll inv2 = mod_inverse(2); template void ifwt(vector& f) { int n = f.size(); for (int i = 1; i < n; i <<= 1) { for (int j = 0; j < n; j++) { if ((j & i) == 0) { T x = f[j], y = f[j | i]; f[j] = (x + y) * inv2 % MOD, f[j | i] = (x - y) * inv2 % MOD; } } } } signed main() { fio(); int n, k, x, y; cin >> n >> k >> x >> y; a.resize(k); rep (i, k) cin >> a[i]; sort(all(a)); UNIQUE(a); vll dp(a.size(), vl(m)); vl path; dfs(path, n / 2, dp); // DEBUG_MAT(dp); vl sum(m); rep (i, m) { rep (j, a.size()) { sum[i] += dp[j][i]; } sum[i] %= MOD; } vl c(m); rep (i, m) { rep (j, m) { c[i ^ j] += sum[i] * sum[j] % MOD; c[i ^ j] %= MOD; } } // DEBUG_VEC(c); vl d(m); rep (k, a.size()) { vl f = dp[k]; // for (int i = 1; i < m; i <<= 1) { // for (int j = 0; j < m; j++) { // if ((j & i) == 0) { // ll x = dp[k][j], y = dp[k][j | i]; // dp[k][j] = x + y, dp[k][j | i] = x - y; // } // } // } fwt(f); rep (i, m) (f[i] *= f[i]) %= MOD; ifwt(f); rep (i, m) { (d[i] += f[i]) %= MOD; // (d[i] += dp[k][i]) %= MOD; } } // DEBUG_MAT(dp); // DEBUG_VEC(d); ll ans = 0; rep (i, m) { if (in(i, x, y + 1)) { ans += c[i] - d[i]; } } ans = (ans % MOD + MOD) % MOD; cout << ans << endl; }