Given are N pairwise distinct non-negative integers A_1,A_2,\ldots,A_N. Find the number of ways to choose a set of between 1 and K numbers (inclusive) from the given numbers so that the following two conditions are satisfied:

* The bitwise AND of the chosen numbers is S.
* The bitwise OR of the chosen numbers is T.

Constraints

* 1 \leq N \leq 50
* 1 \leq K \leq N
* 0 \leq A_i < 2^{18}
* 0 \leq S < 2^{18}
* 0 \leq T < 2^{18}
* A_i \neq A_j (1 \leq i < j \leq N)

Input

Input is given from Standard Input in the following format:


N K S T
A_1 A_2 ... A_N


Output

Print the answer.

Examples

Input

3 3 0 3
1 2 3


Output

2


Input

5 3 1 7
3 4 9 1 5


Output

2


Input

5 4 0 15
3 4 9 1 5


Output

3

Difficulty: UNKNOWN_DIFFICULTY

Solutions:
import sys
readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda : readline().rstrip()
ni = lambda : int(readline().rstrip())
nm = lambda : map(int, readline().split())
nl = lambda : list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

def popcount(x):
	x = x - (x >> 1 & 1431655765)
	x = (x & 858993459) + (x >> 2 & 858993459)
	x = x + (x >> 4) & 252645135
	x = x + (x >> 8)
	x = x + (x >> 16)
	return x & 127

def solve():
	(n, k, s, t) = nm()
	a = [x ^ s for x in nl() if x & s == s and x | t == t]
	n = len(a)
	t ^= s
	s = 0
	C = [[0] * (n + 1) for i in range(n + 1)]
	for i in range(n + 1):
		for j in range(i + 1):
			if j == 0:
				C[i][j] = 1
			elif i > 0:
				C[i][j] = C[i - 1][j] + C[i - 1][j - 1]
	D = [0] * (n + 1)
	for i in range(n + 1):
		for j in range(1, min(k, n) + 1):
			D[i] += C[i][j]
	for i in range(n, 0, -1):
		D[i] -= D[i - 1]
	l = list()
	for i in range(20, -1, -1):
		if t & 1 << i:
			l.append(i)
	p = len(l)
	na = list()
	for x in a:
		v = 0
		for i in l:
			v = v << 1 | x >> i & 1
		na.append(v)
	pc = [popcount(i) for i in range(1 << p)]
	l = [0] * (1 << p)
	ans = 0
	for bit in range(1 << p):
		cur = 0
		for x in na:
			l[bit & x] += 1
			cur += D[l[bit & x]]
		for x in na:
			l[bit & x] -= 1
		if pc[bit] & 1:
			ans -= cur
		else:
			ans += cur
	print(ans)
	return
solve()


def cmb(n, r, mod):
	if r < 0 or r > n:
		return 0
	r = min(r, n - r)
	return g1[n] * g2[r] * g2[n - r] % mod
mod = 10 ** 18 + 7
N = 50
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]
for i in range(2, N + 1):
	g1.append(g1[-1] * i % mod)
	inverse.append(-inverse[mod % i] * (mod // i) % mod)
	g2.append(g2[-1] * inverse[-1] % mod)
(N, K, T, S) = map(int, input().split())
a = list(map(int, input().split()))
must0 = [i for i in range(18) if S >> i & 1 == 0]
must1 = [i for i in range(18) if T >> i & 1 == 1]
A = []
for val in a:
	check = True
	for j in must0:
		check = check & (val >> j & 1 == 0)
	for j in must1:
		check = check & (val >> j & 1 == 1)
	if check:
		A.append(val)
if not A:
	print(0)
	exit()
bit = []
for i in range(18):
	if i not in must0 and i not in must1:
		bit.append(i)
for i in range(len(A)):
	temp = 0
	for j in range(len(bit)):
		temp += (A[i] >> bit[j] & 1 == 1) * 2 ** j
	A[i] = temp
ans = 0
n = len(bit)
for i in range(2 ** n):
	dic = {}
	for a in A:
		val = a & i
		if val not in dic:
			dic[val] = 0
		dic[val] += 1
	temp = 0
	for val in dic:
		for j in range(1, min(K, dic[val]) + 1):
			temp += cmb(dic[val], j, mod)
	popcount = 0
	for j in range(n):
		popcount += i >> j & 1
	ans += temp * (-1) ** popcount
print(ans % mod)