Chef wants to buy a stock whose price was S rupees when the market opened. He will buy the stock if and only if its price is in the range [A, B]. The price of the stock has changed by C\% by the time he was trying to buy the stock. Will he be able to buy the stock?

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

- First line of the input contains T, the number of testcases. Then the test cases follow.
- Each test case contains 4 space-separated integers S, A, B, C in a single line.

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

For each test case, if Chef buys the stock print YES, otherwise print NO.

You may print each character of the string in uppercase or lowercase (for example, the strings yEs, yes, Yes, and YES will all be treated as identical).

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

$1 ≤ T ≤ 1000$
$0 ≤ S ≤ 10^{6}$
$0 ≤ A ≤ B ≤ 10^{6}$
$-100 ≤ C ≤ 100$

----- Sample Input 1 ------ 
3
100 93 108 7
100 94 100 -7
183 152 172 -17
----- Sample Output 1 ------ 
Yes
No
No
----- explanation 1 ------ 
- Test Case $1$: The price of the stock after gaining $7\%$ will become $107$, which is in Chef's range of $[93, 108]$. Hence, Chef will buy the stock.
- Test Case $2$: The price of the stock after falling $7\%$ will become $93$, which is not in Chef's range of $[94, 100]$. Hence, Chef will not buy the stock.
- Test Case $3$: The price of the stock after falling $17\%$ will become $151.89$, which is not in Chef's range of $[152, 172]$. Hence, Chef will not buy the stock.

Difficulty: EASY
Tags: Mathematics

Data structures

Implementation
Skill types: Data structures

Starter code:

Solutions:
for _ in range(int(input())):
	(s, a, b, c) = map(int, input().split())
	d = s * c / 100 + s
	if d >= a and d <= b:
		print('Yes')
	else:
		print('No')


t = int(input())
for _ in range(t):
	(s, a, b, c) = map(int, input().split())
	p = s * c / 100
	k = s + p
	if a <= k <= b:
		print('Yes')
	else:
		print('No')


for t in range(int(input())):
	(S, A, B, C) = map(int, input().split())
	price = S * C / 100 + S
	if A <= price <= B:
		print('Yes')
		pass
	else:
		print('No')
		pass


t = int(input())
while t > 0:
	(s, a, b, c) = map(float, input().split())
	count = c * s / 100
	disc = count + s
	if disc >= a and disc <= b:
		print('Yes')
	else:
		print('No')
	t -= 1


t = int(input())
for i in range(t):
	(s, a, b, c) = map(float, input().split())
	new = s + s * c // 100
	if new >= a and new < b or new == b:
		print('Yes')
	else:
		print('No')


t = int(input())
for i in range(t):
	(s, a, b, c) = map(int, input().split())
	if a <= s * c / 100 + s <= b:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	l = list(map(int, input().split()))
	x = l[0] + l[0] * l[-1] // 100
	if l[1] <= x <= l[2]:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	arr1 = [int(x) for x in input().split()]
	percent = arr1[-1]
	chng_price = arr1[0] + arr1[0] * (percent / 100)
	if arr1[1] <= chng_price <= arr1[2]:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	(s, x, y, z) = map(int, input().split())
	res = s + z / 100 * s
	if x <= res <= y:
		print('Yes')
	else:
		print('No')


for i in range(int(input())):
	(s, a, b, c) = map(int, input().split())
	k = s * c * 1 / 100
	x = s + k
	if x >= a and x <= b:
		print('Yes')
	else:
		print('No')


t = int(input())
while t:
	(s, a, b, c) = map(int, input().split())
	new_price = s + c / 100 * s
	if new_price >= a and new_price <= b:
		print('Yes')
	else:
		print('No')
	t -= 1


T = int(input())
for i in range(T):
	(S, A, B, C) = map(int, input().split())
	if S + C / 100 * S >= A and S + C / 100 * S <= B:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	(value, range1, range2, percentage) = list(map(int, input().split()))
	k = percentage * 0.01
	m = value * k
	non = value + m
	if non >= range1 and non <= range2:
		print('Yes')
	else:
		print('No')


t = int(input())
for _ in range(t):
	(s, a, b, c) = map(int, input().split())
	if c > 0:
		s = s + c * s / 100
	else:
		s = s - abs(c) * s / 100
	if a <= s <= b:
		print('Yes')
	else:
		print('No')


for t in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	x = a + a * (d / 100)
	if x >= b and x <= c:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	(a, b, c, d) = [int(x) for x in input().split()]
	m = a * (d / 100) + a
	if b <= m <= c:
		print('Yes')
	else:
		print('No')


for i in range(int(input())):
	a = list(map(int, input().split()))
	if a[0] + a[0] * (a[3] / 100) >= a[1] and a[0] + a[0] * (a[3] / 100) <= a[2]:
		print('Yes')
	else:
		print('No')


for i in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	e = a / 100 * d
	f = a + e
	if f >= b and f <= c:
		print('Yes')
	else:
		print('No')