king-kala-and-the-partition-line
Source: hackerearth
Difficulty: EASY

After obtaining a lot of gold from capturing different kingdoms, King Kala buys a large area of land. N trees are planted on the land, numbered from 1 to N. Each tree i, has coordinates as Xi, Yi. King Kala has two sons who, as their father, are selfish. To divide the land between two sons, King Kala draws a partition line on the land which is given by three coefficients of the line equation A, B and C. Now, Prince Parmar, being the elder son got a chance to pick any one side. But he wants the side of the partition which contains the maximum number of trees. How many trees can he get?

Input

The first line contains the number of test cases T. In each test case, the first line contains N. The next line contains three space separated integers A, B and C. The next N lines contain Xi, Yi which are the co-ordinates of N trees.

Output

For each test case, print the maximum number of trees which are completely on one side of the partition line.

Constraints

1 ≤ T ≤10
1 ≤ N ≤ 10^5
-100 ≤ A,B ≤ 100
-10^5 ≤ C, Xi, Yi ≤ 10^5

SAMPLE INPUT
1
4
1 -1 0
2 1
1 3
4 2
3 3

SAMPLE OUTPUT
2


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
#print 'Hello World!'
t=eval(input())
while t>0:
	t-=1
	n=eval(input())
	a,b,c=list(map(int,input().split()))
	p=0
	z=0
	while n>0:
		n-=1
		x,y=list(map(int,input().split()))
		if a*x+b*y+c>0:
			p+=1
		elif a*x+b*y+c<0:
			z+=1
	print(max(p,z))


t=eval(input())
count=0
count1=0
while (t):
	n=eval(input())
	d=list(map(int,input().strip().split(' ')))
	a=d[0]
	b=d[1]
	c=d[2]
	for i in range (n):
		x,y=input().strip().split(' ')
		x,y=[int(x),int(y)]
	    
		w=a*x+b*y+c
		if(w>0):
			count=count+1
		elif(w==0):
			count1=count1+1
	if(n-count1-count>count):
		print(n-count1-count)
	else:
		print(count)
	count=0
	count1=0
	t=t-1


tc = int(input())
while tc>0:
	tc = tc - 1
	n = int(input())
	a, b, c = list(map(int, input().split()))
	lc, rc = 0, 0
	for i in range(n):
		x, y = list(map(int, input().split()))
		if a*x + b*y + c > 0:
			lc = lc + 1
		elif a*x + b*y + c < 0:
			rc = rc + 1
	print(max(lc,rc))


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
#print 'Hello World!'
t=eval(input())
while t>0:
	t-=1
	n=eval(input())
	a,b,c=list(map(int,input().split()))
	p=0
	z=0
	while n>0:
		n-=1
		x,y=list(map(int,input().split()))
		if a*x+b*y+c>0:
			p+=1
		elif a*x+b*y+c<0:
			z+=1
	print(max(p,z))


tc = int(input())
while tc>0:
	tc = tc - 1
	n = int(input())
	a, b, c = list(map(int, input().split()))
	lc, rc = 0, 0
	for i in range(n):
		x, y = list(map(int, input().split()))
		if a*x + b*y + c > 0:
			lc = lc + 1
		elif a*x + b*y + c < 0:
			rc = rc + 1
	print(max(lc,rc))