Motu and Patlu are racing against each other on a circular track of radius $R$. Initially they are at the same point on the track and will run in same direction .The coach ordered them to run $X$ rounds of the circular field. Patlu wants to know how many times they will meet after the race starts and  before any of them finishes $X$ rounds. But he is busy in warm up so he wants you to calculate this. You are given speed of both Motu and Patlu ($A$ and $B$). 

-----Input:-----
- First line will contain $T$, number of testcases. Then the testcases follow. 
- Each testcase contains of a single line of input, four integers $X, R, A, B$. 

-----Output:-----
For each testcase, output in a single line answer the number of times whey will meet before any of them completes $X$ rounds.

-----Constraints-----
- $1 \leq T \leq 1000$
- $1 \leq R \leq 10^9$
- $1 \leq X \leq 10^9$
- $1 \leq A \leq 10^9$
- $1 \leq B \leq 10^9$
- Speed of both are different

-----Sample Input:-----
2
3 10 2 5
2 20 5 10

-----Sample Output:-----
1
0

Difficulty: UNKNOWN_DIFFICULTY

Solutions:
import math

def swap(a, b):
	return (b, a)
t = int(input())
while t != 0:
	z = list(map(int, input().strip().split(' ')))
	x = z[0]
	r = z[1]
	a = z[2]
	b = z[3]
	peri = 2 * r
	tp = x * peri
	if a < b:
		(a, b) = swap(a, b)
	t1 = tp / a
	d2 = t1 * b
	dd = abs(tp - d2)
	if dd % peri == 0:
		print(int(dd // peri) - 1)
	else:
		n = int(dd // peri)
		print(n)
	t -= 1


t = int(input())
k = 0
for i in range(0, t):
	(x, r, a, b) = map(int, input().split(' '))
	if a < b:
		c = r / b
		d = c * (b - a)
		e = d * x
		f = int(e / r)
		g = e % r
		if g == 0:
			print(f - 1)
		else:
			print(f)
	else:
		c = r / a
		d = c * (a - b)
		e = d * x
		f = int(e / r)
		g = e % r
		if g == 0:
			print(f - 1)
		else:
			print(f)


import re
for t in range(int(input())):
	list = re.findall('[0-9]+', input())
	a = max(int(list[2]), int(list[3]))
	b = min(int(list[2]), int(list[3]))
	x = int(list[0])
	r2 = int(b * x / a)
	print(x - r2 - 1)


import numpy as np
T = int(input())
for i in range(T):
	S = input().split(' ')
	X = int(S[0])
	R = int(S[1])
	A = int(S[2])
	B = int(S[3])
	d = int(abs(A - B) * X / max(A, B))
	if X * abs(A - B) % max(A, B) == 0:
		d = d - 1
	print(d)


t = int(input())
for z in range(t):
	(x, r, a, b) = list(map(int, input().split()))
	d = abs(a - b)
	if d == 0:
		print('0')
	else:
		count = 0
		mt = x * r * 1.0 / max(a, b) * 1.0
		dmt = r * 1.0 / d * 1.0
		ans = int(mt * 1.0 / dmt * 1.0)
		if ans * dmt * 1.0 == mt:
			print(int(ans - 1))
		else:
			print(int(ans))


for _ in range(int(input())):
	(x, r, a, b) = map(int, input().split())
	print(x - 1 - x * min(a, b) // max(a, b))


t = int(input())
while t != 0:
	(rounds, r, x, y) = list(map(int, input().split()))
	rv = abs(x - y)
	mv = max(x, y)
	ans = rounds * (rv / mv)
	if ans - int(ans) == 0:
		print(int(ans) - 1)
	else:
		print(int(ans))
	t = t - 1


t = int(input(''))
for i in range(t):
	(x, r, a, b) = map(int, input().split())
	win = max(a, b)
	rel = abs(a - b)
	d = rel * x / win
	if d == int(d):
		print(int(d - 1))
	else:
		print(int(d))


import math
z = int(input())
for _ in range(z):
	[x, r, a, b] = [int(y) for y in input().split()]
	if x * min(a, b) == max(a, b):
		print(x - 2)
	elif x * abs(b - a) % max(a, b) == 0:
		print(math.floor(x * abs(a - b) / max(a, b)) - 1)
	else:
		print(math.floor(x * abs(a - b) / max(a, b)))


t = int(input())
while t:
	t = t - 1
	(x, r, a, b) = input().split()
	x = int(x)
	r = int(r)
	a = int(a)
	b = int(b)
	le = 3.1415926 * 2 * r * x
	rel = abs(a - b)
	m = le / rel
	hr = le / max(a, b)
	hr = hr * x
	print(int(hr / m - 0.0001))


import math
t = int(input())
for _ in range(t):
	z = input().split()
	x = int(z[0])
	r = int(z[1])
	a = int(z[2])
	b = int(z[3])
	length = 2 * math.pi * r
	if b > a:
		temp = a
		a = b
		b = temp
	first_meet = length / (a - b)
	total_time = x * length / a
	if first_meet == total_time:
		ans = 0
	else:
		ans = int(total_time / first_meet)
	print(ans)


from math import pi as p
from math import gcd, ceil
t = int(input())
while t > 0:
	t -= 1
	(x, r, a, b) = map(int, input().split())
	cir = 2 * p * r
	t1 = cir / a
	t2 = cir / b
	tf = cir / abs(a - b)
	s = min(t1, t2) * x
	s = s / tf
	s = ceil(s)
	print(s - 1)


try:
	t = int(input())
	for _ in range(t):
		(x, r, A, B) = map(int, input().split())
		if A < B:
			(A, B) = (B, A)
		q = 2 * (22 / 7) * r
		t = q / abs(A - B) * A
		d = x * q
		ans = d / t
		if ans == int(ans):
			print(int(ans) - 1)
		else:
			print(int(ans))
except:
	pass


def solve():
	(x, r, a, b) = map(int, input().split())
	d = 2 * 3.14 * r
	td = x * d
	fm = d / abs(a - b)
	temp = fm * max(a, b)
	if td % temp == 0:
		return int(td // temp) - 1
	else:
		return int(td // temp)
t = int(input())
for loop in range(t):
	print(solve())


a = int(input())
for i in range(0, a):
	(x, r, a, b) = map(int, input().split())
	maxx = max(a, b)
	minn = min(a, b)
	ans = x - x * (minn / maxx)
	if ans - int(ans) == 0:
		ans = ans - 1
	else:
		ans = int(ans)
	print(int(ans))


import math
for _ in range(int(input())):
	(x, r, a, b) = list(map(int, input().split()))
	s1 = max(a, b)
	s2 = min(a, b)
	circum = 2 * math.pi * r
	total_dist = circum * x
	total_time = total_dist / s1
	first_interaction = circum / (s1 - s2)
	ans = int(total_time / first_interaction)
	if total_time != first_interaction:
		print(ans)
	else:
		print(max(ans - 1, 0))


t = int(input())
while t > 0:
	(x, r, a, b) = map(int, input().split())
	val = x * abs(a - b) // max(a, b)
	rem = x * abs(a - b) % max(a, b)
	if rem == 0:
		print(val - 1)
	else:
		print(val)
	t -= 1


for _ in range(int(input())):
	(x, r, a, b) = map(int, input().split())
	c = max(a, b)
	ans = x * abs(b - a)
	if ans % c == 0:
		print(ans // c - 1)
	else:
		print(ans // c)


import math

def fun(X, R, A, B):
	if A > B:
		if X * (A - B) % A == 0:
			return max(X * (A - B) // A - 1, 0)
		else:
			return X * (A - B) // A
	elif B > A:
		if X * (B - A) % B == 0:
			return max(X * (B - A) // B - 1, 0)
		else:
			return X * (B - A) // B
	else:
		return 0
for _ in range(int(input())):
	(X, R, A, B) = list(map(int, input().strip().split()))
	print(fun(X, R, A, B))


def main():
	(x, r, a, b) = list(map(int, input().split()))
	num_meets = int(x * abs(a - b) / max(a, b))
	if x * (a - b) % max(a, b) == 0:
		num_meets -= 1
	print(num_meets)
t = int(input())
for _ in range(t):
	main()


from math import pi, ceil
T = int(input())
for t in range(T):
	(X, R, A, B) = map(int, input().split())
	turn = 2 * pi * R
	D = turn * X
	time = D / max(A, B)
	d = time * min(A, B)
	delta = D - d
	print(ceil(delta / turn) - 1)


t = int(input())
for _ in range(t):
	(x, r, a, b) = list(map(int, input().split()))
	wa = a / r
	wb = b / r
	wd = abs(wa - wb)
	time = x / max(wa, wb)
	dist = wd * time
	if dist == int(dist):
		ans = int(dist) - 1
	else:
		ans = int(dist)
	print(ans)


import sys
import math

def main():
	input = sys.stdin.readline
	t = int(input())
	while t > 0:
		t -= 1
		(x, r, a, b) = (int(i) for i in input().split())
		circle = 2 * r * math.pi
		total = x * circle
		if a < b:
			(a, b) = (b, a)
		time = total / a
		y = b * time
		y = y / circle
		res = math.ceil(x - y) - 1
		print(res)
main()