#include<bits/stdc++.h>
using namespace std;
typedef long long int Long;
//typedef long long int ll;
typedef int ll;
typedef ll ft;
typedef set< int > si;
typedef long long Long;
typedef vector< int > vi;
typedef vector< vi> vii;
typedef vector< Long> vl;
typedef pair< int ,int > pii;
typedef pair< Long,Long> pll;
typedef pair< string,int > psi;
typedef pair< double ,double > pdd;
#define get getchar_unlocked
#define put putchar_unlocked
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sz size()
#define ln length()
#define repstl(i, s) for (__typeof((s).end())i=(s).begin();i!=(s).end();++i)
#define debug1(s,a) cout << s << " " << a << " " << endl;
#define debug2(s,a,b) cout << s << " " << a << " " << b << " " << endl
#define debug3(s,a,b,c) cout << s << " " << a << " " << b << " " << c << " " << endl;
#define debug4(s,a,b,c,d) cout << s << " " << a << " " << b << " " << c << " " << d << " " << endl;
#define debug5(s,a,b,c,d,e) cout << s << " " << a << " " << b << " " << c << " " << d << " " << e << " " << endl;
#define PI 3.1415926535897932384626433832795
#define FO freopen ("out.txt", "w", stdout)
#define FI freopen ("in.txt", "r", stdin)
#define ref(i,a,n) for(int i=a;i<=n;i++)
#define reb(i,n,a) for(int i=n;i>=a;i--)
#define rep(i,n) for(int i=0;i<n;i++)
#define all(a) a.begin(),a.end()
#define gi(n) scanf("%d",&n)
#define gii(n) scanf("%lld",&n)
#define gc(c) scanf(" %c",&c)
#define gs(s) scanf(" %s",s);
#define pi(n) printf("%d",n)
#define pii(n) printf("%lld",n)
#define pc(c) printf("%c",c)
#define ps printf(" ")
#define pn printf("\n")
#define pl(a) printf("%s",a)
#define l(a) 2*a+1
#define r(a) 2*a+2
#define left(a,b) a,(a+b)/2
#define right(a,b) (a+b)/2+1,b
#define mid(a,b) (a+b)/2
void gl( char * str) { register char c= 0 ; register int i= 0 ; while ( c< 33 ) c= get( ) ; while ( c! = '\n ' ) { str[ i] = c; c= get( ) ; i= i+ 1 ; } str[ i] = '\0 ' ; }
void gfi( ft & x) { register ft c = get( ) ; x = 0 ; ft sn= 1 ; for ( ; ( c< 48 || c> 57 ) ; c = get( ) ) if ( c== '-' ) sn= - 1 ; for ( ; c> 47 && c< 58 ; c = get( ) ) { x = ( x<< 1 ) + ( x<< 3 ) + c - 48 ; } x* = sn; }
//int dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
//int dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//int dx[]={2,1,-1,-2,-1,1};int dy[]={0,1,1,0,-1,-1}; //Hexagonal Direction
#define E 401*251
#define MAX numeric_limits<ll>::max()
ll to[ E] ,next[ E] ,fin[ E] ,flow[ E] ,cap[ E] ,dist[ E] ,pro[ E] ,nEdge,nNode,src,snk,N;
void init( ll _nNode,ll _src,ll _snk) {
src= _src; snk= _snk;
nNode= _nNode; nEdge= 0 ;
rep( i,nNode+ 1 ) fin[ i] = - 1 ;
}
void add( ll u,ll v) {
to[ nEdge] = u; cap[ nEdge] = 1 ; flow[ nEdge] = 0 ; next[ nEdge] = fin[ v] ; fin[ v] = nEdge++ ;
to[ nEdge] = v; cap[ nEdge] = 1 ; flow[ nEdge] = 0 ; next[ nEdge] = fin[ u] ; fin[ u] = nEdge++ ;
}
struct node {
ll x,y;
} P[ E] ,T[ E] ;
typedef struct node nod;
ll D( nod a,nod b) {
// cout << a.x << " " << a.y << " " << b.x << " " << b.y << endl;
return abs ( a.x - b.x ) + abs ( a.y - b.y ) ;
}
ll bfs( ) {
queue< ll> q;
dist[ src] = 0 ;
q.push ( src) ;
ref( i,1 ,nNode) dist[ i] = - 1 ;
while ( ! q.empty ( ) ) {
ll u= q.front ( ) ;
q.pop ( ) ;
for ( int i= fin[ u] ; i>= 0 ; i= next[ i] ) {
ll v= to[ i] ;
if ( dist[ v] == - 1 && ( cap[ i] - flow[ i] ) > 0 ) dist[ v] = dist[ u] + 1 ,q.push ( v) ;
}
}
return dist[ snk] ! = - 1 ;
}
ll dfs( ll u,ll d) {
if ( u== snk) return d;
for ( int & i= pro[ u] ; i>= 0 ; i= next[ i] ) {
ll v= to[ i] ;
if ( ( cap[ i] - flow[ i] ) > 0 && dist[ v] == dist[ u] + 1 ) {
ll temp= dfs( v,min( d,cap[ i] - flow[ i] ) ) ;
if ( temp> 0 ) {
flow[ i] + = temp;
flow[ i^ 1 ] - = temp;
return temp;
}
}
}
return 0 ;
}
ll dinitz( ) {
ll ans= 0 ;
while ( bfs( ) ) {
rep( i,nNode+ 1 ) pro[ i] = fin[ i] ;
while ( 1 ) {
ll temp= dfs( src,MAX) ;
if ( temp) ans+ = temp; else break ;
}
}
return ans;
}
int main( ) {
ll t;
gfi( t) ;
while ( t-- ) {
ll n,m,s,c;
gfi( n) ; gfi( m) ; gfi( s) ; gfi( c) ;
N= n+ m+ 1 ;
init( N,0 ,N) ;
ref( i,1 ,n) add( 0 ,i) ;
ref( i,n+ 1 ,n+ m) add( i,n+ m+ 1 ) ;
rep( i,n) gfi( P[ i] .x ) ,gfi( P[ i] .y ) ;
rep( i,m) gfi( T[ i] .x ) ,gfi( T[ i] .y ) ;
rep( i,n) rep( j,m) {
// cout << "dist: " << D(P[i],T[j]) << " " << (s*c)/200 << endl;
if ( D( P[ i] ,T[ j] ) <= ( s* c) / 200 ) {
// cout << "add: " << i+1 << " " << j+1 << endl;
add( i+ 1 ,j+ 1 + n) ;
}
}
pi( dinitz( ) ) ; pn;
}
return 0 ;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKdHlwZWRlZiBsb25nIGxvbmcgaW50IExvbmc7Ci8vdHlwZWRlZiBsb25nIGxvbmcgaW50IGxsOwp0eXBlZGVmIGludCBsbDsKdHlwZWRlZiBsbCBmdDsKdHlwZWRlZiBzZXQ8aW50PiBzaTsKdHlwZWRlZiBsb25nIGxvbmcgTG9uZzsKdHlwZWRlZiB2ZWN0b3I8a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