To address the situation of Water Scarcity in Chefland, Chef has started an awareness campaign to motivate people to use greywater for toilets, washing cars, gardening, and many other chores which don't require the use of freshwater. These activities presently consume y liters of water every week per household and Chef thinks through this campaign he can help cut down the total usage to \lfloor \frac{y}{2} \rfloor.

Assuming x liters of water every week per household is consumed at chores where using freshwater is mandatory and a total of C liters of water is available for the entire Chefland having H households for a week, find whether all the households can now have sufficient water to meet their requirements.

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

- First line will contain T, number of testcases. Then the testcases follow. 
- Each testcase contains of a single line of input, four integers H, x, y, C. 

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

Print a single line containing the string "YES" if it is possible to meet the requirement of all the households in Chefland or "NO" if it is impossible (without quotes).

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

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

$1 ≤ T ≤ 300$
$1 ≤ H, x, y ≤ 10$
$1 ≤ C ≤ 100$

----- Sample Input 1 ------ 
3
3 1 1 3
1 1 1 2
2 1 1 1
----- Sample Output 1 ------ 
YES
YES
NO
----- explanation 1 ------ 
TestCase 1: 
Total consumption of a single household after using greywater = $1 +$ $\lfloor \frac{1}{2} \rfloor$ = $1 + 0$ = $1$ liter.

Total consumption of three households after using greywater = $3 * 1 = 3$ liters which is equal to the available quantity of water.

TestCase 2: 
Total consumption of a single household after using greywater = $1 +$ $\lfloor \frac{1}{2} \rfloor$ = $1 + 0$ = $1$ liter which is less than the available quantity of water.

TestCase 3: 
Total consumption of a single household after using greywater = $1 +$ $\lfloor \frac{1}{2} \rfloor$ = $1 + 0$ = $1$ liter.

Total consumption of two households after using greywater = $2 * 1 = 2$ liters which is more than the available quantity of water.

Difficulty: EASY
Tags: Mathematics

Starter code:

Solutions:
t = int(input())
for i in range(t):
	(H, x, y, C) = map(int, input().split())
	if H * (x + y // 2) <= C:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(h, x, y, c) = map(int, input().split())
	if h * (x + y // 2) <= c:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	if a * (b + c // 2) <= d:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	l = list(map(int, input().split()))
	H = l[0]
	x = l[1]
	y = l[2]
	C = l[3]
	if H * (x + y // 2) > C:
		print('NO')
	else:
		print('YES')


import math
T = int(input(''))

def savew():
	(H, x, y, C) = map(int, input().split())
	K = (x + y // 2) * H
	if K <= C:
		print('YES')
	else:
		print('NO')
while T > 0:
	savew()
	T = T - 1


t = int(input())
while t:
	t -= 1
	(h, x, y, c) = map(int, input().split())
	a = x + y // 2
	b = h * a
	if b <= c:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	(h, x, y, c) = list(map(int, input().split()))
	m = x + y // 2
	if m * h <= c:
		print('YES')
	else:
		print('NO')


T = int(input())
for i in range(T):
	(H, x, y, C) = map(int, input().split())
	totalGreywater = x + y // 2
	totalWaterReqd = H * totalGreywater
	if totalWaterReqd <= C:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(h, x, y, c) = map(int, input().split())
	a = x + int(y / 2)
	b = h * a
	if b <= c:
		print('YES')
	else:
		print('NO')


import math
T = int(input())
for i in range(T):
	(H, X, Y, C) = map(int, input().split())
	n1 = math.floor(Y / 2)
	n2 = n1 + X
	n3 = H * n2
	if n3 <= C:
		print('YES')
	else:
		print('NO')


import math
for _ in range(int(input())):
	(H, x, y, C) = map(int, input().split())
	tC = x + math.floor(y / 2)
	tA = H * tC
	if tA <= C:
		print('YES')
	else:
		print('NO')


a = int(input())
lis = []
b = 0
while a > 0:
	(h, x, y, c) = map(int, input().split())
	b = x + y // 2
	if c >= h * b:
		lis.append('YES')
	else:
		lis.append('NO')
	a = a - 1
for i in lis:
	print(i)


n = int(input())
lis = []
for i in range(0, n):
	(h, x, y, c) = [int(i) for i in input().split(' ')]
	x = y // 2 + x
	if h * x <= c:
		lis.append('YES')
	else:
		lis.append('NO')
for i in lis:
	print(i)


T = int(input())
for _ in range(T):
	(H, x, y, C) = map(int, input().split())
	grey_water = x + int(y / 2)
	gray_water_consumption = grey_water * H
	print('YES') if gray_water_consumption <= C else print('NO')


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	e = b + c // 2
	if e * a <= d:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(x, a, b, y) = map(int, input().split())
	if (a + int(b / 2)) * x <= y:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(house, fresh, grey, total) = map(int, input().split())
	print('YES') if (fresh + int(grey / 2)) * house <= total else print('NO')


import math
for i in range(int(input())):
	(x, y, z, c) = map(int, input().split())
	a = math.floor(z / 2)
	k = (y + a) * x
	if k <= c:
		print('YES')
	else:
		print('NO')


n = int(input())
for _ in range(n):
	(x, y, z, p) = map(int, input().split())
	s = y + z // 2
	if s * x <= p:
		print('YES')
	else:
		print('NO')


testcases = int(input())
for i in range(testcases):
	(h, x, y, c) = map(int, input().split())
	gw = x + y // 2
	con = h * gw
	if con <= c:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(h, x, y, c) = map(int, input().split())
	sum = x + y // 2
	tot = sum * h
	if tot <= c:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(H, x, y, C) = list(map(int, input().split()))
	a = y // 2 + x
	b = H * a
	if C >= b:
		print('YES')
	else:
		print('NO')