#include #pragma GCC target("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") using namespace std; #define ll long long #define rep(i, m, n) for (ll i = m; i < n; i++) #define mod 998244353 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) { ll x = f[j], y = f[j | i]; f[j] = x + y, f[j | i] = x - y; } } } } 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) { ll x = f[j], y = f[j | i]; f[j] = (x + y) * 499122177 % mod, f[j | i] = (x - y + mod) % mod * 499122177 % mod; } } } } int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); ll N, K, X, Y; cin >> N >> K >> X >> Y; ll M = 262144; vector> dp(M, vector(2)); vector H(M, 0); rep(i, 0, K) { ll A; cin >> A; H[A] = 1; } fwt(H); rep(v, 0, M) dp[v][1] = H[v]; rep(v, 0, M) dp[v][0] = (dp[v][1] * H[v] - K + mod) % mod; rep(v, 0, M) { vector> mt(2, vector(2)); mt[0] = {H[v], (1 - K + mod) % mod}; mt[1] = {1, 0}; ll P = N - 1; while(P) { if(P & 1) { ll x = dp[v][0]; dp[v][0] = (dp[v][0] * mt[0][0] % mod + dp[v][1] * mt[0][1] % mod) % mod; dp[v][1] = x; } vector> res(2, vector(2, 0)); rep(i, 0, 2) rep(j, 0, 2) rep(k, 0, 2) res[i][j] = (res[i][j] + mt[i][k] * mt[k][j] % mod) % mod; mt = res; P /= 2; } } vector ep(M); rep(v, 0, M) ep[v] = dp[v][1]; ifwt(ep); ll res = 0; rep(v, X, Y + 1) res = (res + ep[v]) % mod; cout << (res + mod) % mod << endl; }