Problem: 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

Solution (in CPP):

Solution:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define N 109
int a[N],n,k,s,t,tot;
int vis[300009];
ll C[N][N],D[N][N];
int main() 
{
	cin>>n>>k>>s>>t;	
	for (int i=0;i<=n;i++) D[i][0]=C[i][0]=1;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=i;j++) 
		{
			C[i][j]=C[i-1][j]+C[i-1][j-1];
			D[i][j]=D[i][j-1]+C[i][j]; 
		}
	for(int i=1,x;i<=n;i++) 
	{
		scanf("%d",&x);
		if ((x&s)==s && (x&t)==x)
			a[++tot]=x;
	} 
	t^=s;
	int cnt=0;
	for(int j=0;j<18;j++)
		if(t>>j&1) cnt++;
	//printf("%d %d\n",cnt,tot);
	for(int i = 1; i <= tot; i++) 
	{
		int val=1,sum=0;
		for(int j=0;j<18;j++) 
		{
			if((a[i]>>j&1) && (t>>j&1)) sum+=val;
			if(t>>j&1) val*=2;
		}
		a[i]=sum;
	}
	ll ans=0;
	for(int i=0;i<(1<<cnt);i++) vis[i]=0;
	for(int t=0;t<(1<<cnt);t++) 
	{
		int s=1;
		for(int j=0;j<cnt;j++)
			if(t>>j&1) s*=-1;
		ll sum=0;
		for(int i=1;i<=tot;i++) 
		{
			sum-=D[vis[a[i]&t]][min(vis[a[i]&t],k)];
			vis[a[i]&t]++;
			sum+=D[vis[a[i]&t]][min(vis[a[i] & t],k)];
		}
		for(int i=1;i<=tot;i++)
			vis[a[i]&t]--;
		ans+=s*sum;
	}
	printf("%lld\n",ans);
	return 0;
}