Read problems statements in [Mandarin Chinese], [Russian], [Vietnamese], and [Bengali] as well.

No play and eating all day makes your belly fat. This happened to Chef during the lockdown. His weight before the lockdown was $w_{1}$ kg (measured on the most accurate hospital machine) and after $M$ months of lockdown, when he measured his weight at home (on a regular scale, which can be inaccurate), he got the result that his weight was $w_{2}$ kg ($w_{2} > w_{1}$).

Scientific research in all growing kids shows that their weights increase by a value between $x_{1}$ and $x_{2}$ kg (inclusive) per month, but not necessarily the same value each month. Chef assumes that he is a growing kid. Tell him whether his home scale could be giving correct results.

------  Input ------
The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
The first and only line of each test case contains five space-separated integers $w_{1}$, $w_{2}$, $x_{1}$, $x_{2}$ and $M$. 

------  Output ------
For each test case, print a single line containing the integer $1$ if the result shown by the scale can be correct or $0$ if it cannot.

------  Constraints ------
$1 ≤ T ≤ 10^{5}$
$1 ≤ w_{1} < w_{2} ≤ 100$
$0 ≤ x_{1} ≤ x_{2} ≤ 10$
$1 ≤ M ≤ 10$

----- Sample Input 1 ------ 
5

1 2 1 2 2

2 4 1 2 2

4 8 1 2 2

5 8 1 2 2

1 100 1 2 2
----- Sample Output 1 ------ 
0

1

1

1

0
----- explanation 1 ------ 
Example case 1: Since the increase in Chef's weight is $2 - 1 = 1$ kg and that is less than the minimum possible increase $1 \cdot 2 = 2$ kg, the scale must be faulty.

Example case 2: Since the increase in Chef's weight is $4 - 2 = 2$ kg, which is equal to the minimum possible increase $1 \cdot 2 = 2$ kg, the scale is showing correct results.

Example case 3: Since the increase in Chef's weight is $8 - 4 = 4$ kg, which is equal to the maximum possible increase $2 \cdot 2 = 4$ kg, the scale is showing correct results.

Example case 4: Since the increase in Chef's weight $8 - 5 = 3$ kg lies in the interval $[1 \cdot 2, 2 \cdot 2]$ kg, the scale is showing correct results.

Example case 5: Since the increase in Chef's weight is $100 - 1 = 99$ kg and that is more than the maximum possible increase $2 \cdot 2 = 4$ kg, the weight balance must be faulty.

Difficulty: EASY

Solutions:
for i in range(int(input())):
	(a, b, c, d, m) = map(int, input().split())
	if b - a >= c * m and b - a <= d * m:
		print(1)
	else:
		print(0)


for i in range(int(input())):
	(w1, w2, x1, x2, M) = list(map(int, input().split()))
	d = w2 - w1
	mi = x1 * M
	ma = x2 * M
	if d in range(mi, ma + 1):
		print(1)
	else:
		print(0)


for i in range(int(input())):
	(w1, w2, x1, x2, m) = map(int, input().split())
	a = w2 - w1
	b = x1 * m
	c = x2 * m
	if c >= a and b <= a:
		print(1)
	else:
		print(0)


for _ in range(int(input())):
	l = [int(x) for x in input().split()]
	print(1 if l[1] - l[0] <= l[-1] * l[-2] and l[1] - l[0] >= l[-1] * l[-3] else 0)


def correct(w1, w2, x1, x2, m):
	inc = w2 - w1
	upper = m * x2
	lower = m * x1
	if lower <= inc <= upper:
		return 1
	return 0
t = int(input())
for i in range(t):
	(w1, w2, x1, x2, m) = map(int, input().split())
	print(correct(w1, w2, x1, x2, m))


T = int(input())
for i in range(T):
	(w1, w2, x1, x2, m) = input().split(' ')
	w1 = int(w1)
	w2 = int(w2)
	x1 = int(x1)
	x2 = int(x2)
	m = int(m)
	inc = w2 - w1
	a = m * x1
	b = m * x2
	if inc >= a and inc <= b:
		print('1')
	else:
		print('0')


for x in range(int(input())):
	(w1, w2, x1, x2, M) = list(map(int, input().split()))
	if w2 - w1 in range(x1 * M, x2 * M + 1):
		print('1')
	else:
		print('0')


for i in range(int(input())):
	(w1, w2, x1, x2, m) = map(int, input().split())
	diff = w2 - w1
	if diff >= m * x1 and diff <= m * x2:
		print(1)
	else:
		print(0)


testcases = int(input())
for i in range(testcases):
	(s3, s4, k9, k3, u) = list(map(int, input().split()))
	if s4 <= s3 + k3 * u and s4 >= s3 + k9 * u:
		print('1')
	else:
		print('0')


for _ in range(int(input())):
	(w1, w2, x1, x2, m) = map(int, input().split())
	c = w2 - w1
	l1 = x1 * m
	l2 = x2 * m
	if c == l1 or c == l2 or l1 < c < l2:
		print(1)
	else:
		print(0)


for i in range(int(input())):
	(w1, w2, x1, x2, M) = list(map(int, input().split()))
	diff = w2 - w1
	md = x1 * M
	maxd = x2 * M
	if diff in range(md, maxd + 1):
		print(1)
	else:
		print(0)


T = int(input())
for t in range(T):
	(w1, w2, x1, x2, m) = map(int, input().split())
	diff = w2 - w1
	d1 = x1 * m
	d2 = x2 * m
	if d1 <= diff <= d2:
		print('1')
	else:
		print('0')


n = int(input())
for i in range(n):
	(a, b, c, d, e) = map(int, input().split())
	if b - a in range(c * e, d * e + 1):
		print('1')
	else:
		print('0')


t = int(input())
for i in range(t):
	(w1, w2, x1, x2, m) = map(int, input().split())
	weight_diff = w2 - w1
	min_limit = x1 * m
	max_limit = x2 * m
	if weight_diff < min_limit or weight_diff > max_limit:
		print(0)
	else:
		print(1)


for case in range(int(input())):
	(W1, W2, X1, X2, M) = map(int, input().split())
	if W2 - W1 >= X1 * M and W2 - W1 <= X2 * M:
		print(1)
	else:
		print(0)


for _ in range(int(input())):
	(w, x, y, z, m) = map(int, input().split())
	t = x - w
	print(1) if y * m <= t <= z * m else print(0)


t = int(input())
for _ in range(t):
	(w1, w2, x1, x2, m) = map(int, input().split())
	min_increase = x1 * m
	max_increase = x2 * m
	actual_increase = w2 - w1
	if actual_increase >= min_increase and actual_increase <= max_increase:
		print(1)
	else:
		print(0)


for i in range(int(input())):
	A = [int(n) for n in input().split()]
	avg = (A[1] - A[0]) / A[4]
	if avg > max(A[2], A[3]) or avg < min(A[2], A[3]):
		print(0)
	else:
		print(1)


T = int(input())
for i in range(T):
	(w1, w2, x1, x2, M) = map(int, input().split())
	d = w2 - w1
	minimum = x1 * M
	maximum = x2 * M
	if d < minimum or d > maximum:
		print('0')
	else:
		print('1')


for _ in range(int(input())):
	(w1, w2, x1, x2, m) = map(int, input().split())
	print(1 if x1 * m <= w2 - w1 <= x2 * m else 0)


for i in range(int(input())):
	(w1, w2, x1, x2, M) = map(int, input().split())
	result = 0
	min_limit = x1 * M
	max_limit = x2 * M
	weight_diff = w2 - w1
	if weight_diff < min_limit:
		print(result)
	elif weight_diff == min_limit or weight_diff == max_limit or (weight_diff > min_limit and weight_diff < max_limit):
		result = 1
		print(result)
	elif weight_diff > max_limit:
		print(result)


inp = int(input())
for i in range(0, inp):
	lst = list(map(int, input().split(' ')))
	if lst[1] - lst[0] <= lst[3] * lst[4] and lst[2] * lst[4] <= lst[1] - lst[0]:
		print('1')
	else:
		print('0')


t = int(input())
while t > 0:
	(w1, w2, x1, x2, m) = list(map(int, input().split()))
	diff = w2 - w1
	x1 = x1 * m
	x2 = x2 * m
	if diff >= x1 and diff <= x2:
		print(1)
	else:
		print(0)
	t -= 1


for _ in range(int(input())):
	l = list(map(int, input().split()))
	if l[1] - l[0] >= l[2] * l[4] and l[1] - l[0] <= l[3] * l[4]:
		print(1)
	else:
		print(0)


for i in range(int(input())):
	(w1, w2, x1, x2, m) = map(int, input().split())
	a = w2 - w1
	mi = x1 * m
	ma = m * x2
	if a >= mi and a <= ma:
		print(1)
	else:
		print(0)


for i in range(int(input())):
	(w1, w2, x1, x2, M) = map(int, input().split())
	change = w2 - w1
	if change < x1 * M or change > x2 * M:
		print('0')
	else:
		print('1')


t = int(input())
for i in range(t):
	(w_1, w_2, x_1, x_2, m) = list(map(int, input().split()))
	if w_2 <= w_1 + x_2 * m and w_2 >= w_1 + x_1 * m:
		print('1')
	else:
		print('0')


for t in range(int(input())):
	(w1, w2, x1, x2, m) = map(int, input().split())
	w = w2 - w1
	a = x1 * m
	b = x2 * m
	if w not in range(a, b + 1):
		print(0)
	else:
		print(1)


s = int(input())
for i in range(s):
	(a, b, x1, x2, m) = map(int, input().split())
	if x2 * m >= b - a and x1 * m <= b - a:
		print(1)
	else:
		print(0)


for _ in range(int(input())):
	(a, b, x, y, m) = map(int, input().split())
	n = (b - a) / m
	if n >= x and n <= y:
		print(1)
	else:
		print(0)


def main():
	T = int(input())
	while T > 0:
		check_weight()
		T -= 1

def check_weight():
	(w1, w2, x1, x2, M) = map(int, input().split())
	result = 0
	min_limit = x1 * M
	max_limit = x2 * M
	weight_diff = w2 - w1
	if weight_diff < min_limit:
		print(result)
	elif weight_diff == min_limit or weight_diff == max_limit or (weight_diff > min_limit and weight_diff < max_limit):
		result = 1
		print(result)
	elif weight_diff > max_limit:
		print(result)
main()


t = int(input())
for i in range(t):
	(A, B, C, D, E) = map(int, input().split())
	K = B - A
	if C * E <= K <= D * E:
		print(1)
	else:
		print(0)


t = int(input())
for i in range(t):
	(w1, w2, x1, x2, m) = map(int, input().split())
	w3 = w2 - w1
	if x1 * m <= w3 <= x2 * m:
		print(1)
	else:
		print(0)


T = int(input())
for i in range(0, T):
	(w1, w2, x1, x2, M) = map(int, input().split())
	a = x1 * M
	b = x2 * M
	if w2 - w1 >= a and w2 - w1 <= b:
		print('1')
	else:
		print('0')


for i in range(int(input())):
	(a, b, c, d, e) = [int(x) for x in input().split()]
	diff = b - a
	l = c * e
	h = d * e
	if diff >= l and diff <= h:
		print(1)
	else:
		print(0)


def perhitungan(berat_awal, berat_akhir, batas_awal, batas_akhir, bulan):
	selisih_berat = berat_akhir - berat_awal
	if batas_awal * bulan <= selisih_berat <= batas_akhir * bulan:
		print(1)
	else:
		print(0)
T = int(input())
for i in range(T):
	(w1, w2, x1, x2, m) = map(int, input().split(' '))
	perhitungan(w1, w2, x1, x2, m)


for _ in range(int(input())):
	(w1, w2, x1, x2, M) = map(int, input().split())
	x = (w2 - w1) / M
	print(int(x >= x1 and x <= x2))


for _ in range(int(input())):
	(a, b, c, d, e) = map(int, input().split())
	diff = b - a
	c = c * e
	d = d * e
	if diff >= c and diff <= d:
		print('1')
	else:
		print('0')


for _ in range(int(input())):
	(w, W, x, X, m) = map(int, input().split())
	if m * x <= W - w <= m * X:
		print('1')
	else:
		print('0')


for i in range(int(input())):
	(belo, aflo, x1, x2, M) = map(int, input().split())
	dif = aflo - belo
	maxi = M * x2
	mini = M * x1
	if dif in range(mini, maxi + 1):
		print('1')
	else:
		print('0')


for i in range(int(input())):
	(w1, w2, x1, x2, M) = map(int, input().split())
	k = w2 - w1
	x1 *= M
	x2 *= M
	if k >= x1 and k <= x2:
		print(1)
	else:
		print(0)


t = int(input())
for i in range(t):
	(w1, w2, x1, x2, m) = map(int, input().split())
	increase = w2 - w1
	min_val = x1 * m
	max_val = x2 * m
	if increase >= min_val and increase <= max_val:
		print(1)
	else:
		print(0)


for i in range(int(input())):
	(a, b, c, d, e) = map(int, input().split())
	r = b - a
	s = c * e
	t = d * e
	if r < s or r > t:
		print('0')
	else:
		print('1')


t = int(input())
for i in range(t):
	(w1, w2, x1, x2, M) = map(int, input().split())
	lower = x1 * M
	upper = x2 * M
	w = w2 - w1
	if w < lower:
		print('0')
	elif w == lower or w == upper or (w > lower and w < upper):
		print('1')
	elif w > upper:
		print('0')


for t in range(int(input())):
	(w1, w2, x1, x2, m) = map(int, input().split())
	diffw = w2 - w1
	if diffw / m <= x2 and diffw / m >= x1:
		print(1)
	else:
		print(0)


T = int(input())
for t in range(0, T):
	(w1, w2, x1, x2, M) = map(int, input().split())
	kid_lims = [x1 * M, x2 * M]
	chef_change = w2 - w1
	cond = chef_change >= kid_lims[0] and chef_change <= kid_lims[1]
	if cond:
		print(1)
	else:
		print(0)


t = int(input())
for _ in range(t):
	(w1, w2, x1, x2, m) = map(int, input().split())
	a = w2 - w1
	b = x1 * m
	c = x2 * m
	if a in range(b, c + 1):
		print('1')
	else:
		print('0')


for t in range(int(input())):
	(w1, w2, x1, x2, m) = map(int, input().split())
	w = w2 - w1
	x = x1 * m
	y = x2 * m
	if w not in range(x, y + 1):
		print(0)
	else:
		print(1)


t = int(input())
for i in range(t):
	(w1, w2, x1, x2, M) = list(map(int, input().split()))
	dif = w2 - w1
	min_dif = x1 * M
	max_dif = x2 * M
	if dif in range(min_dif, max_dif + 1):
		print('1')
	else:
		print('0')


for t in range(int(input())):
	(w1, w2, x1, x2, M) = map(int, input().split())
	result = 0
	min = x1 * M
	max = x2 * M
	diff = w2 - w1
	if diff < min:
		print(result)
	elif diff == min or diff == max or (diff > min and diff < max):
		result = 1
		print(result)
	elif diff > max:
		print(result)


for i in range(int(input())):
	(w1, w2, x1, x2, M) = list(map(int, input().split()))
	diff = w2 - w1
	min = x1 * M
	max = x2 * M
	if diff in range(min, max + 1):
		print(1)
	else:
		print(0)


t = int(input())
i = 1
while i <= t:
	i += 1
	(Wi, Wf, a, b, M) = map(int, input().split())
	if Wi + M * a <= Wf <= Wi + M * b:
		print(1)
	else:
		print(0)


for i in range(int(input())):
	a = input().split()
	mn = int(a[2]) * int(a[4])
	mx = int(a[3]) * int(a[4])
	wt = int(a[1]) - int(a[0])
	if wt >= mn and wt <= mx:
		print('1')
	else:
		print('0')


for t in range(int(input())):
	(a, b, c, d, e) = map(int, input().split())
	aa = b - a
	if aa >= e * c and aa <= e * d:
		print('1')
	else:
		print('0')


t = int(input())
for x in range(t):
	(w1, w2, x1, x2, M) = map(int, input().split())
	diff = w2 - w1
	min_d = x1 * M
	max_d = x2 * M
	if diff in range(min_d, max_d + 1):
		print(1)
	else:
		print(0)


test = int(input())
for test_cases in range(test):
	(w1, w2, x1, x2, M) = map(int, input().split())
	min_weight = w1 + x1 * M
	max_weigth = w1 + x2 * M
	if min_weight <= w2 <= max_weigth:
		print(1)
	else:
		print(0)


T = int(input())
for i in range(T):
	(w1, w2, x1, x2, m) = map(int, input().split())
	gain = w2 - w1
	per = gain / m
	if per >= x1 and per <= x2:
		print('1')
	else:
		print('0')


for _ in range(int(input())):
	(a, b, c, d, e) = map(int, input().split())
	limit_1 = c * e
	limit_2 = d * e
	gain_in_weight = b - a
	if gain_in_weight >= limit_1 and gain_in_weight <= limit_2:
		print(1)
	else:
		print(0)


T = int(input())
for t in range(T):
	(w1, w2, x1, x2, M) = [int(x) for x in input().split()]
	w = w2 - w1
	if w < x1 * M or w > x2 * M:
		print(0)
	elif w >= x1 * M and w <= x2 * M:
		print(1)


t = int(input())
for i in range(t):
	(w1, w2, x1, x2, m) = map(int, input().split())
	mininc = m * x1
	maxinc = m * x2
	winc = w2 - w1
	interval = []
	for j in range(mininc, maxinc + 1):
		interval.append(j)
	if winc == mininc or winc == maxinc:
		print('1')
	elif winc in interval:
		print('1')
	else:
		print('0')


T = int(input())
for i in range(T):
	(w1, w2, x1, x2, M) = map(int, input().split())
	W = w2 - w1
	D = W / M
	if x1 <= D and D <= x2:
		print('1')
	else:
		print('0')


n = int(input())
a = []
b = []
for i in range(n):
	a.append(list(map(int, input().split())))
for i in a:
	if i[2] * i[4] <= i[1] - i[0] <= i[3] * i[4]:
		print(1)
	else:
		print(0)


for i in range(int(input())):
	a = list(map(int, input().split()))
	p = a[1] - a[0]
	q = a[2] * a[4]
	r = a[3] * a[4]
	if p in range(q, r + 1):
		print(1)
	else:
		print(0)