Problem: A boy PCK had N straight iron bars, which were serially indexed. Unfortunately, the first M bars (0 ≤ M ≤ N) among them were bent during transportation. They all suffered a perpendicular bend at one point.

He is planning to make a cube using a set of bars selected using the following rules: X bars from bent ones, Y bars from straight ones, where 2X + Y = 12. Any two bars can be jointed only at the apexes of the cube. He wants to count how many types of rectangular parallelepipeds (hereafter RP) he can make using these bars.

Make a program to count out types (different shapes) of RPs that PCK can make using the following information: the number of bars and length of each one, position of the bend, and the number of bars to be used to construct an RP. Note that any two RPs similar in shape are considered identical: namely if the length of three defining sides of two RPs coincide if arranged in increasing/decreasing order (e.g., three sides of RP i and j are A_i, B_i, C_i, and A_j, B_j and C_j in increasing order, then the relations A_i = A_j, B_i = B_j, and C_i = C_j hold. Note also that the bars are sufficiently thin to allow you to consider them as idealized lines.



Input

The input is given in the following format.


N M X Y
a_1
a_2
:
a_N
b_1
b_2
:
b_M


The first line provides the total number of iron bars and bent bars, and those straight and bent bars used to construct an RP: N (6 ≤ N ≤ 6000), M (0 ≤ M ≤ N), X (0 ≤ X ≤ 6), and Y (0 ≤ Y ≤ 12). The following relations always hold for them: 2X+Y=12, X+Y ≤ N, X ≤ M. Each of the subsequent N lines provides the length of the i-th bar a_i (1 ≤ a_i ≤ 6000) in integers. Furthermore, each of the subsequent M lines provides the location at which the i-th bent bar suffered a perpendicular bend b_i (1 ≤ b_i ≤ 3000) in centimeters from one end of the bar (note: 1 ≤ a_i-b_i ≤ 3000).

Output

Output the number of constructible rectangular parallelepipeds.

Example

Input

18 8 3 6
4
3
3
3
3
2
2
2
1
1
1
1
1
2
2
3
3
3
1
1
1
1
1
1
1
1


Output

3

Solution (in CPP):

Solution:
#include<bits/stdc++.h>
using namespace std;
#define MAX_LEN 3000
typedef long long ll;
int N,M,twoc,onec;
int s[3000],t[3000];
int one[MAX_LEN*2+1];
int two[MAX_LEN+1][MAX_LEN+1];
int al[MAX_LEN*2+1];
int Two(int a,int b){
  if(a>3000 || b>3000)return 0;
  else return two[a][b];
}
bool check(int X,int Y,int Z){
  if(X>Y)swap(X,Y);
  if(Y>Z)swap(Y,Z);
  if(X>Y)swap(X,Y);
  
  if(X==Y&&Y==Z)return ( two[X][X] >= twoc && one[X] >= onec );
  if( (X==Y&&Y<Z) || (X<Y&&Y==Z) ){
    // make_prism
    if(X<Y&&Y==Z)swap(X,Z);
    
    for(int xz=0;xz<=twoc;xz++){
      
      int xx=twoc-xz;
      if(Two(X,Z)<xz)continue;//if(two[X][Z]<xz)continue;
      if(Two(X,X)<xx)continue;//if(two[X][X]<xx)continue;
      if(xz==0 && xx>4)continue;
      if(xz==1 && xx>3)continue;
      if(xz==2 && xx>3)continue;
      if(xz==3 && xx>2)continue;
      if(xz==4 && xx>2)continue;
      if(xz>4)continue;
      if(one[Z]>=4-xz)
        if(one[X]>=8-xz-xx*2)
          return true;
    }
    
    /*
      if( two[X][Z] >= 0 && one[Z] >= 4 && one[X]+min(4,two[X][X])*2 >= 8 )return true;
      if( two[X][Z] >= 1 && one[Z] >= 3 && one[X]+min(3,two[X][X])*2 >= 7 )return true;
      if( two[X][Z] >= 2 && one[Z] >= 2 && one[X]+min(3,two[X][X])*2 >= 6 )return true;
      if( two[X][Z] >= 3 && one[Z] >= 1 && one[X]+min(2,two[X][X])*2 >= 5 )return true;
      if( two[X][Z] >= 4 && one[Z] >= 0 && one[X]+min(2,two[X][X])*2 >= 4 )return true;
    */
    return false;
  }
  if( twoc == 0 ){
    return ( one[X]>=4 && one[Y]>=4 && one[Z]>=4 );
  }
  if( twoc == 1 ){
    if(Two(X,Y)>=1&&one[X]>=3&&one[Y]>=3&&one[Z]>=4)return true;
    //if(two[X][Y]>=1&&one[X]>=3&&one[Y]>=3&&one[Z]>=4)return true;
    
    if(Two(Y,Z)>=1&&one[X]>=4&&one[Y]>=3&&one[Z]>=3)return true;
    //if(two[Y][Z]>=1&&one[X]>=4&&one[Y]>=3&&one[Z]>=3)return true;
    if(Two(Z,X)>=1&&one[X]>=3&&one[Y]>=4&&one[Z]>=3)return true;
    //if(two[Z][X]>=1&&one[X]>=3&&one[Y]>=4&&one[Z]>=3)return true;
    return false;
  }
  
  if( twoc <= 4 ){
    for(int xy=0;xy<=twoc;xy++){
      
      //if(xy>two[X][Y])continue;
      if(xy>Two(X,Y))continue;
      
      for(int yz=0;yz<=twoc-xy;yz++){
        
        //if(yz>two[Y][Z])continue;
        if(yz>Two(Y,Z))continue;
        int zx=twoc-xy-yz;
        
        if(zx<0)continue;
        
        //if(zx>two[Z][X])continue;
        if(zx>Two(Z,X))continue;
        
        if( one[X]>=4-xy-zx && one[Y]>=4-xy-yz && one[Z]>=4-yz-zx ){
          return true;
        }
      }
    }
    return false;
  }
  
  if( twoc == 5 ){
    //if( two[X][Y] >= 2 && two[Y][Z]>=2 && two[Z][X]>=1 && one[Z]>=1 && one[X]>=1 )return true;
    if( Two(X,Y) >= 2 && Two(Y,Z)>=2 && Two(Z,X)>=1 && one[Z]>=1 && one[X]>=1 )return true;
    
    //if( two[X][Y] >= 2 && two[Y][Z]>=1 && two[Z][X]>=2 && one[Y]>=1 && one[Z]>=1 )return true;
    if( Two(X,Y) >= 2 && Two(Y,Z)>=1 && Two(Z,X)>=2 && one[Y]>=1 && one[Z]>=1 )return true;
    
    //if( two[X][Y] >= 1 && two[Y][Z]>=2 && two[Z][X]>=2 && one[X]>=1 && one[Y]>=1 )return true;
    if( Two(X,Y) >= 1 && Two(Y,Z)>=2 && Two(Z,X)>=2 && one[X]>=1 && one[Y]>=1 )return true;
    
    //if( two[X][Y] >= 3 && two[Y][Z]>=1 && two[Z][X]>=1 && one[Z]>=2 )return true;
    if( Two(X,Y) >= 3 && Two(Y,Z)>=1 && Two(Z,X)>=1 && one[Z]>=2 )return true;
    
    //if( two[X][Y] >= 1 && two[Y][Z]>=1 && two[Z][X]>=3 && one[Y]>=2 )return true;
    if( Two(X,Y) >= 1 && Two(Y,Z)>=1 && Two(Z,X)>=3 && one[Y]>=2 )return true;
    
    //if( two[X][Y] >= 1 && two[Y][Z]>=3 && two[Z][X]>=1 && one[X]>=2 )return true;
    if( Two(X,Y) >= 1 && Two(Y,Z)>=3 && Two(Z,X)>=1 && one[X]>=2 )return true;
    
    return false;
  }
  
  if( twoc == 6 ){
    //if( two[X][Y]>=2 && two[Y][Z]>=2 && two[Z][X]>=2 )return true;
    if( Two(X,Y)>=2 && Two(Y,Z)>=2 && Two(Z,X)>=2 )return true;
    return false;
  }
}
ll solve(){
  ll res=0;
  if( onec == 12 ){
    ll cnt=0;
    for(int i=1;i<=MAX_LEN*2;i++){
      one[i]/=4;
      if(one[i]>=3)res++;
      if(one[i]>=1)cnt++;
    }
    res+= cnt*(cnt-1)/2*(cnt-2)/3;
    for(int i=1;i<=MAX_LEN;i++)
      if(one[i]>=2)res+=(cnt-1);
    return res;
  }else{
    unordered_set< long long > sst;
    set< long long > st;
    
    for(int j=1;j<=MAX_LEN*2;j++){
      if(al[j]==0)continue;
      for(int i=0;i<M;i++){
        long long a=s[i];
        long long b=t[i];
        long long c=j;
        if(a>b)swap(a,b);
        if(b>c)swap(b,c);
        if(a>b)swap(a,b);
        if(check(a,b,c)){
          long long key = a+b*10000+c*100000000;
          sst.insert(key);
          st.insert(key);
        }
      }
    }
    //    for(long long x : st ){
    //      cout<<x%10000<<' '<<x/10000%10000<<' '<<x/100000000%10000<<endl;
    //    }
    res=sst.size();
  }
  
  return res;
}
int main(){
  cin>>N>>M>>twoc>>onec;
  
  for(int i=0;i<M;i++){
    cin>>s[i];
  }
  
  for(int i=0;i<N-M;i++){
    int len;
    cin>>len;
    one[ len ]++;
    al[ len ]++;
  }
  
  for(int i=0;i<M;i++){
    cin>>t[i];
    s[i]-=t[i];
    if(s[i]>t[i])swap(s[i],t[i]);
    
    two[ s[i] ][ t[i] ]++;
    if( t[i]!=s[i] )  two[ t[i] ][ s[i] ]++;
    
    al[ s[i] ]++;
    al[ t[i] ]++;
  }
  cout<< solve() <<endl;
  return 0;
}