mod = 998244353 n, k, x, y = map(int, input().split()) a = set(map(int, input().split())) k = len(a) x = min(x, 1024) y = min(y, 1023) dp = [[0] * 1024 for i in range(n + 1)] dp[0][0] = 1 for i in range(n): for prev in range(1024): for item in a: dp[i + 1][item ^ prev] += dp[i][prev] if i > 0: dp[i + 1][prev] -= k * dp[i - 1][prev] if i > 1: for item in a: dp[i + 1][prev] += dp[i - 2][item ^ prev] print(sum(dp[n][x:y+1]) % mod)