Chef's playlist contains 3 songs named A, B, and C, each of duration exactly X minutes. Chef generally plays these 3 songs in loop, i.e, A \rightarrow B \rightarrow C \rightarrow A \rightarrow B \rightarrow C \rightarrow A \rightarrow \dots

Chef went on a train journey of N minutes and played his playlist on loop for the whole journey. How many times did he listen to the song C completely?

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

- The first line of input will contain a single integer T, denoting the number of test cases. The description of the test cases follows.
- Each test case consists of a single line of input, containing two space-separated integers N, X.

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

For each test case, output on a new line the number of times Chef listens to the song C completely.

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

$1 ≤ T ≤ 1000$
$1 ≤ N ≤ 100$
$1 ≤ X ≤ 10$

----- Sample Input 1 ------ 
5
6 1
5 1
11 2
5 8
100 9

----- Sample Output 1 ------ 
2
1
1
0
3

----- explanation 1 ------ 
Test case $1$: Since each song is of duration $1$ minute and the journey is $6$ minutes long, Chef listens each of the songs $A, B, C$ twice.

Test case $2$: Since each song is of duration $1$ minute and the journey is $5$ minutes long, Chef listens the songs $A, B$ twice but $C$ only once.

Test case $3$: Since each song is of duration $2$ minutes and the journey is $11$ minutes long, Chef listens the songs $A, B$ twice but $C$ only once. Note that Chef is in the middle of listening to song $C$ for the second time when the journey ends, but it is not counted since he hasn't listened to it fully.

Test case $4$: Chef cannot hear any song since the journey is shorter than his song duration.

Source: codechef | Difficulty: EASY
Tags: Mathematics


Solutions:
n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	c = a // b
	d = c // 3
	print(d)


t = int(input())
for i in range(t):
	(x, y) = map(int, input().split(' '))
	print(x // (y * 3))


t = int(input())
for _ in range(t):
	(n, x) = map(int, input('').split())
	a = n // x
	b = a // 3
	print(b)


import math
t = int(input())
for t in range(t):
	(n, x) = map(int, input().split())
	y = n / (x * 3)
	print(math.floor(y))


t = int(input())
for i in range(t):
	(n, x) = list(map(int, input().split()))
	print(int(n / (x * 3)))


for _ in range(int(input())):
	(n, x) = list(map(int, input().split()))
	print(n // (3 * x))


T = int(input())
for i in range(T):
	(N, X) = map(int, input().split())
	final = int(N / (X * 3))
	print(final)


n = int(input())
for i in range(n):
	(x, y) = list(map(int, input().split()))
	a = y * 3
	b = x // a
	print(b)


t = int(input())
for u in range(t):
	(N, X) = list(map(int, input().split()))
	print(N // (X * 3))


t = int(input())
for i in range(0, t):
	(n, x) = map(int, input().split())
	lists = []
	for j in range(0, n):
		res = j * (3 * x)
		if res <= n:
			lists.append(j)
	print(max(lists))


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	z = 3 * b
	if z <= a:
		print(a // z)
	else:
		print(0)


n = int(input())
for i in range(0, n):
	(a, b) = map(int, input().split())
	q = int(a / b)
	if a > b:
		print(int(q / 3))
	else:
		print(0)


t = int(input())
while t:
	(n, x) = map(int, input().split())
	a = n / x / 3
	print(int(a))
	t -= 1


x = int(input())
for i in range(x):
	(a, b) = map(int, input().split())
	b = b * 3
	c = a / b
	print(int(c))


T = int(input())
for i in range(T):
	(a, b) = map(int, input().split())
	k = int(a / (3 * b))
	print(k)


for i in range(int(input())):
	(N, X) = map(int, input().split())
	if N >= 3 * X:
		c_song = print(int(N / (3 * X)))
	else:
		print('0')


t = int(input())
for i in range(t):
	l = list(map(int, input().split()))
	print(l[0] // (l[1] * 3))


N = int(input())
for i in range(N):
	(n, x) = map(int, input('').split())
	a = n // x
	b = a // 3
	print(b)


for _ in range(int(input())):
	(a, b) = map(int, input().split(' '))
	print(a // (b * 3))


T = int(input())
for tc in range(T):
	(n, x) = map(int, input().split())
	a = 3 * x
	print(n // a)


t = int(input())
for i in range(0, t):
	(n, x) = map(int, input().split())
	a = 0
	p = 0
	while p < n:
		p += 3 * x
		a += 1
	if n - 3 * (a - 1) * x < 3 * x:
		print(a - 1)
	else:
		print(a)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	k = a // b
	c = k // 3
	print(c)


for i in range(int(input())):
	(w, x) = map(int, input().split())
	print(int(w / (x * 3)))


for _ in range(int(input())):
	l = list(map(int, input().split()))
	print(l[0] // (l[1] * 3))


n = int(input())
for i in range(n):
	lst = list(map(int, input().split()))[:2]
	if lst[0] < lst[1]:
		print('0')
	else:
		n = lst[0] // lst[1]
		print(n // 3)


n = int(input())
for i in range(n):
	(p, q) = map(int, input().split())
	a = q * 3
	b = p // a
	print(b)


T = int(input())
for i in range(T):
	(X, Y) = map(int, input().split())
	timeC = X // (3 * Y)
	print(timeC)


import math
n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	x = a / (3 * b)
	print(math.floor(x))


for i in range(int(input())):
	(n, x) = map(int, input().split())
	k = n // (3 * x)
	print(k)


T = int(input())
for i in range(0, T):
	(n, x) = map(int, input().split())
	s = 3 * x
	print(int(n / s))


t = int(input())
while t > 0:
	(n, x) = map(int, input().split())
	print(n // (x * 3))
	t -= 1


T = int(input())
for i in range(T):
	(N, X) = map(int, input().split())
	A = N / X
	B = A / 3
	print(int(B))


T = int(input())
while T:
	T -= 1
	(N, X) = map(int, input().split())
	total = X * 3
	print(N // total)


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	if n % (x * 3) == 0:
		print(n // (x * 3))
	else:
		print(n // (x * 3))


for i in range(int(input())):
	l1 = [int(x) for x in input().split()]
	x = int(l1[0] // (3 * l1[1]))
	print(x)


t = int(input())
for i in range(t):
	(X, Y) = list(map(int, input().split()))
	a = Y * 3
	print(X // a)


for i in range(int(input())):
	(x, y) = map(int, input().split())
	c = 0
	while x > 0:
		x = x - 2 * y
		if x >= y:
			c += 1
			x = x - y
	print(c)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	ans = b * 3
	res = a // ans
	print(res)


T = int(input())
for num in range(0, T):
	(n, x) = map(int, input().split())
	a = 3 * x
	print(int(n / a))


t = int(input())
while t:
	(x, y) = map(int, input().split())
	print(x // (y * 3))
	t = t - 1