#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; using ull = unsigned long long; template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } //template T gcd(T a, T b) { a = abs(a), b = abs(b); while (b > 0) { tie(a, b) = make_pair(b, a % b); }return a; } //mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); constexpr long long INF = 1LL << 60; constexpr int inf = 1000000007; //constexpr long long mod = 1000000007LL; constexpr long long mod = 998244353; struct mint { long long x; mint(long long x = 0) :x((x% mod + mod) % mod) {} mint& operator+=(const mint a) { if ((x += a.x) >= mod) x -= mod; return *this; } mint& operator-=(const mint a) { if ((x += mod - a.x) >= mod) x -= mod; return *this; } mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; } mint operator+(const mint a) const { mint res(*this); return res += a; } mint operator-(const mint a) const { mint res(*this); return res -= a; } mint operator*(const mint a) const { mint res(*this); return res *= a; } mint pow(ll t) const { if (!t) return 1; mint a = pow(t >> 1); a *= a; if (t & 1) a *= *this; return a; } // for prime mod mint inv() const { return pow(mod - 2); } mint& operator/=(const mint a) { return (*this) *= a.inv(); } mint operator/(const mint a) const { mint res(*this); return res /= a; } }; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int n, K, x, y; cin >> n >> K >> x >> y; vector a(K); for (int i = 0; i < K; i++) cin >> a[i]; if (x >= 1024) { cout << 0 << "\n"; return 0; } sort(a.begin(), a.end()); a.erase(unique(a.begin(), a.end()), a.end()); K = a.size(); vector dp(2, vector(1024, vector(K))); for (int i = 0; i < K; i++) dp[0][a[i]][i] = 1; int cur = 0; int nxt = 1; for (int i = 1; i < n; i++) { for (int j = 0; j < 1024; j++) for (int k = 0; k < K; k++) dp[nxt][j][k] = 0; vector sum(1024); for (int j = 0; j < 1024; j++) { for (int k = 0; k < K; k++) sum[j] += dp[cur][j][k]; } for (int j = 0; j < 1024; j++) { for (int k = 0; k < K; k++) { mint t = sum[j] - dp[cur][j][k]; dp[nxt][j ^ a[k]][k] += t; } } swap(cur, nxt); } mint res = 0; for (int i = x; i <= min(1023, y); i++) for (int j = 0; j < K; j++) res += dp[cur][i][j]; cout << res.x << "\n"; }