Chef is planning to buy a new car for his birthday. After a long search, he is left with 2 choices:

Car 1: Runs on diesel with a fuel economy of x_{1} km/l
Car 2: Runs on petrol with a fuel economy of x_{2} km/l

Chef also knows that
the current price of diesel is y_{1} rupees per litre
the current price of petrol is y_{2} rupees per litre

Assuming that both cars cost the same and that the price of fuel remains constant, which car will minimize Chef's expenses?

Print your answer as a single integer in the following format

If it is better to choose Car 1, print -1
If both the cars will result in the same expenses, print 0
If it is better to choose Car 2, print 1

------ Input Format ------ 

- The first line of input contains a single integer T, denoting the number of test cases. The description of T test cases follows.
- Each test case consists of a single line containing 4 space-separated integers — x_{1}, x_{2}, y_{1}, y_{2}.

------ Output Format ------ 

For each test case, output in a single line the answer as explained earlier.

------ Constraints ------ 

$1 ≤ T ≤ 10000$
$1 ≤ x_{1},x_{2},y_{1},y_{2} ≤ 50$

----- Sample Input 1 ------ 
3
10 5 3 20
7 2 7 2
1 5 3 2
----- Sample Output 1 ------ 
-1
0
1
----- explanation 1 ------ 
Test Case $1$: The cost of driving Car 1 is $\frac{3}{10} = 0.3$ rs/km, and the cost of driving Car 2 is $\frac{20}{5} = 4$ rs/km. Therefore, Car 1 is cheaper to drive, so the output is $-1$.

Test Case $2$: The cost of driving Car 1 is $1$ rs/km, and the cost of driving Car 2 is also $1$ rs/km. Both cars offer the same economy, so the output is $0$.

Test Case $3$: The cost of driving Car 1 is $3$ rs/km and the cost of driving Car 2 is $0.4$ rs/km. Therefore, Car 2 is cheaper to drive, so the output is $1$.

Difficulty: EASY
Tags: Mathematics

Starter code:

Solutions:
for _ in range(int(input())):
	(x1, x2, y1, y2) = map(int, input().split())
	a = y1 / x1
	b = y2 / x2
	if a < b:
		print('-1')
	elif a == b:
		print('0')
	else:
		print('1')


for i in range(int(input())):
	(x1, x2, y1, y2) = map(int, input().split())
	if y1 / x1 < y2 / x2:
		print(-1)
	elif x1 / y1 == x2 / y2:
		print(0)
	else:
		print(1)


t = int(input())
for i in range(t):
	(A, B, C, D) = map(int, input().split())
	a = C / A
	b = D / B
	if a < b:
		print(-1)
	elif a == b:
		print(0)
	else:
		print(1)


t = int(input())
for i in range(0, t):
	(x1, x2, y1, y2) = list(map(int, input().split()))
	if y1 / x1 < y2 / x2:
		print('-1')
	if y1 / x1 == y2 / x2:
		print('0')
	if y1 / x1 > y2 / x2:
		print('1')


t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	if c / a < d / b:
		print(-1)
	elif c / a == d / b:
		print(0)
	else:
		print(1)


n = int(input())
for i in range(n):
	(a1, b1, c1, d1) = map(int, input().split(' '))
	e = c1 / a1
	f = d1 / b1
	if e > f:
		print('1')
	elif e == f:
		print('0')
	else:
		print('-1')


t = int(input())
for i in range(t):
	(x1, x2, x3, x4) = map(int, input().split())
	if x3 / x1 < x4 / x2:
		print('-1')
	elif x3 / x1 == x4 / x2:
		print('0')
	else:
		print('1')


t = int(input())
for i in range(t):
	(x1, x2, y1, y2) = [int(i) for i in input().split()]
	c1 = y1 / x1
	c2 = y2 / x2
	if c1 == c2:
		print(0)
	elif c1 > c2:
		print(1)
	elif c2 > c1:
		print(-1)


for i in range(int(input())):
	(xi, x2, y1, y2) = map(int, input().split())
	a = y1 / xi
	b = y2 / x2
	if a < b:
		print(-1)
	elif b < a:
		print(1)
	else:
		print(0)


r = int(input())
for item in range(r):
	(x1, x2, y1, y2) = map(int, input().split())
	if 1 <= (x1 and x2 and y1 and y2) <= 50:
		cost_driving1 = y1 / x1
		cost_driving2 = y2 / x2
		if cost_driving1 < cost_driving2:
			print(-1)
		if cost_driving2 < cost_driving1:
			print(1)
		if cost_driving1 == cost_driving2:
			print(0)


t = int(input())
for i in range(t):
	(x1, x2, y1, y2) = map(int, input().split())
	a = y1 / x1
	b = y2 / x2
	if a < b:
		print(-1)
	elif b < a:
		print(1)
	elif a == b:
		print(0)


t = int(input())
while t:
	t -= 1
	(a, b, c, d) = map(int, input().split())
	x = c / a
	y = d / b
	if x < y:
		print('-1')
	elif x > y:
		print('1')
	else:
		print('0')


import math

def solution():
	pass
T = int(input())
for _ in range(T):
	(x1, x2, y1, y2) = map(int, input().split())
	if y1 / x1 > y2 / x2:
		print(1)
	elif y1 / x1 < y2 / x2:
		print(-1)
	else:
		print(0)


t = int(input())
for i in range(t):
	(x, y, z, w) = map(int, input().split(' '))
	if z / x < w / y:
		print(-1)
	elif z / x == w / y:
		print(0)
	else:
		print(1)


for t in range(int(input())):
	(x1, x2, y1, y2) = map(float, input().split())
	expenses_car1 = y1 / x1
	expenses_car2 = y2 / x2
	if expenses_car1 < expenses_car2:
		print(-1)
	elif expenses_car1 == expenses_car2:
		print(0)
	else:
		print(1)


for _ in range(int(input())):
	(x1, x2, y1, y2) = map(int, input().split())
	c = x1 / y1
	d = x2 / y2
	if c < d:
		print('1')
	elif c > d:
		print('-1')
	else:
		print('0')


n = int(input())
for i in range(n):
	(a, b, c, d) = list(map(int, input().split()))
	m = c / a
	r = d / b
	if m < r:
		print('-1')
	elif m > r:
		print('1')
	else:
		print('0')


tc = int(input())
for _ in range(tc):
	(a, b, c, d) = map(int, input().split())
	e = c / a
	f = d / b
	if e < f:
		print('-1')
	elif e == f:
		print('0')
	else:
		print('1')


t = int(input())
for i in range(t):
	(a, x, b, y) = map(int, input().split())
	if b / a > y / x:
		print(1)
	elif b / a < y / x:
		print(-1)
	else:
		print(0)


T = int(input())
for i in range(T):
	(a, b, c, d) = map(int, input().split())
	s = c / a
	y = d / b
	if s < y:
		print('-1')
	elif s == y:
		print('0')
	else:
		print('1')


T = int(input())
for _ in range(T):
	(x1, x2, y1, y2) = map(int, input().split())
	fuel_cost1 = y1 / x1
	fuel_cost2 = y2 / x2
	if fuel_cost1 < fuel_cost2:
		print(-1)
	elif fuel_cost1 > fuel_cost2:
		print(1)
	elif fuel_cost1 == fuel_cost2:
		print(0)


t = int(input())
for i in range(t):
	(p, q, r, s) = map(int, input().split())
	a = r / p
	b = s / q
	if a < b:
		print(-1)
	elif a == b:
		print(0)
	else:
		print(1)


def code():
	cases = int(input())
	for _ in range(cases):
		(x1, x2, y1, y2) = map(int, input().split(' '))
		diseal_cost = y1 * 1 / x1
		petrol_cost = y2 * 1 / x2
		if diseal_cost < petrol_cost:
			print(-1)
		if petrol_cost < diseal_cost:
			print(1)
		if petrol_cost == diseal_cost:
			print(0)
code()


t = int(input())
for _ in range(t):
	(x1, x2, y1, y2) = list(map(int, input().split()))
	c1 = y1 / x1
	c2 = y2 / x2
	if c1 == c2:
		print(0)
	elif c1 < c2:
		print(-1)
	else:
		print(1)


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	c1 = c / a
	c2 = d / b
	if c1 > c2:
		print('1')
	elif c1 < c2:
		print('-1')
	else:
		print('0')


n = int(input())
for i in range(n):
	(a, b, c, d) = map(int, input().split())
	x = float(c / a)
	y = float(d / b)
	if x < y:
		print('-1')
	elif x > y:
		print('1')
	else:
		print('0')


t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	z = c / a
	y = d / b
	re = 0
	if z < y:
		re = -1
	elif y < z:
		re = 1
	print(re)


T = int(input())
for _ in range(T):
	(x1, x2, y1, y2) = map(int, input().split())
	(diesel, petrol) = (y1 / x1, y2 / x2)
	if diesel > petrol:
		print(1)
	elif diesel < petrol:
		print(-1)
	else:
		print(0)