#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;
}


Measured memory_bytes: 16076