Businessman Divan loves chocolate! Today he came to a store to buy some chocolate. Like all businessmen, Divan knows the value of money, so he will not buy too expensive chocolate. At the same time, too cheap chocolate tastes bad, so he will not buy it as well.

The store he came to has $n$ different chocolate bars, and the price of the $i$-th chocolate bar is $a_i$ dollars. Divan considers a chocolate bar too expensive if it costs strictly more than $r$ dollars. Similarly, he considers a bar of chocolate to be too cheap if it costs strictly less than $l$ dollars. Divan will not buy too cheap or too expensive bars.

Divan is not going to spend all his money on chocolate bars, so he will spend at most $k$ dollars on chocolates.

Please determine the maximum number of chocolate bars Divan can buy.


-----Input-----

Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 100$). Description of the test cases follows.

The description of each test case consists of two lines. The first line contains integers $n$, $l$, $r$, $k$ ($1 \le n \le 100$, $1 \le l \le r \le 10^9$, $1 \le k \le 10^9$) — the lowest acceptable price of a chocolate, the highest acceptable price of a chocolate and Divan's total budget, respectively.

The second line contains a sequence $a_1, a_2, \ldots, a_n$ ($1 \le a_i \le 10^9$) integers — the prices of chocolate bars in the store.


-----Output-----

For each test case print a single integer — the maximum number of chocolate bars Divan can buy.


-----Examples-----

Input
8
3 1 100 100
50 100 50
6 3 5 10
1 2 3 4 5 6
6 3 5 21
1 2 3 4 5 6
10 50 69 100
20 30 40 77 1 1 12 4 70 10000
3 50 80 30
20 60 70
10 2 7 100
2 2 2 2 2 7 7 7 7 7
4 1000000000 1000000000 1000000000
1000000000 1000000000 1000000000 1000000000
1 1 1 1
1
Output
2
2
3
0
0
10
1
1


-----Note-----

In the first example Divan can buy chocolate bars $1$ and $3$ and spend $100$ dollars on them.

In the second example Divan can buy chocolate bars $3$ and $4$ and spend $7$ dollars on them.

In the third example Divan can buy chocolate bars $3$, $4$, and $5$ for $12$ dollars.

In the fourth example Divan cannot buy any chocolate bar because each of them is either too cheap or too expensive.

In the fifth example Divan cannot buy any chocolate bar because he considers the first bar too cheap, and has no budget for the second or third.

In the sixth example Divan can buy all the chocolate bars in the shop.

Difficulty: EASY

Solutions:
for _ in range(int(input())):
	(n, l, r, k) = [int(i) for i in input().split()]
	a = sorted([int(i) for i in input().split()])
	result = 0
	c = 0
	for i in range(n):
		if a[i] >= l and r >= a[i] and (c + a[i] <= k):
			c += a[i]
			result += 1
	print(result)


a = int(input())
countl = []
for i in range(a):
	(n, l, r, k) = input().split(' ')
	(n, l, r, k) = (int(n), int(l), int(r), int(k))
	price = []
	b = input().split(' ')
	c = []
	for i in b:
		c.append(int(i))
	price = c
	count = 0
	i = 0
	price.sort()
	while k > 0:
		if l - 1 < price[i] and r + 1 > price[i]:
			k = k - price[i]
			if k > -1:
				count += 1
		i += 1
		if i == len(price):
			break
	countl.append(count)
for j in countl:
	print(j)


t = int(input())
for _ in range(t):
	(n, down, up, money) = list(map(int, input().split()))
	arr = list(map(int, input().split()))
	count = 0
	arr.sort()
	for i in range(len(arr)):
		if arr[i] >= down:
			if arr[i] <= up:
				if arr[i] <= money:
					money -= arr[i]
					count += 1
	print(count)


t = int(input())
for _ in range(t):
	(n, l, r, k) = map(int, input().split())
	a = list(map(int, input().split()))
	a.sort()
	res = 0
	s = 0
	for i in a:
		if l <= i <= r and s + i <= k:
			res += 1
			s += i
	print(res)


def solve():
	(n, l, r, k) = [int(x) for x in input().split()]
	a = [int(x) for x in input().split()]
	a.sort()
	count = 0
	for i in a:
		if i < l:
			continue
		elif i > r:
			break
		elif i > k:
			break
		else:
			k -= i
			count += 1
	print(count)
for i in range(int(input())):
	solve()


for _ in range(int(input())):
	(n, l, r, k) = map(int, input().split())
	li = list(map(int, input().split()))
	li.sort()
	ans = 0
	for i in range(n):
		if li[i] >= l:
			if li[i] > r:
				break
			else:
				k = k - li[i]
				if k < 0:
					break
				else:
					ans = ans + 1
	print(ans)


nC = int(input())
for loop in range(nC):
	toks = input().split()
	n = int(toks[0])
	low = int(toks[1])
	high = int(toks[2])
	maxS = int(toks[3])
	toks = input().split()
	nums = []
	for x in toks:
		nums.append(int(x))
	nums.sort()
	res = 0
	spent = 0
	for i in range(len(nums)):
		if nums[i] >= low and nums[i] <= high and (spent + nums[i] <= maxS):
			res += 1
			spent += nums[i]
	print(res)


for _ in range(int(input())):
	(n, l, r, k) = map(int, input().split())
	s = sorted(list((int(i) for i in input().split() if int(i) >= l and int(i) <= r)))
	c = 0
	for i in s:
		if k >= i:
			c += 1
			k -= i
	print(c)


t = int(input())
for i in range(0, t):
	l1 = list(map(int, input().split()))
	n = l1[0]
	l = l1[1]
	r = l1[2]
	k = l1[3]
	l2 = list(map(int, input().split()))
	l2.sort()
	cost_sum = 0
	cho = 0
	for j in l2:
		if cost_sum <= k:
			if l <= j <= r:
				cho = cho + 1
				cost_sum = cost_sum + j
			if cost_sum <= k:
				pass
			else:
				cho = cho - 1
				break
		else:
			break
	print(cho)


for _ in range(int(input())):
	(temp, c) = (0, 0)
	(n, l, r, k) = map(int, input().split())
	a = list(map(int, input().split()))
	acc = []
	tot = 0
	count = 0
	for i in a:
		if i <= r and i >= l:
			acc.append(i)
	acc.sort()
	for i in acc:
		if tot + i > k:
			break
		else:
			tot += i
			count += 1
	print(count)


t = int(input())
for i in range(t):
	(n, l, r, k) = list(map(int, input().split()))
	d = list(map(int, input().split()))
	d.sort()
	cnt = 0
	v = 0
	for i in range(n):
		if d[i] >= l and d[i] <= r:
			if cnt + d[i] <= k:
				cnt += d[i]
				v += 1
		else:
			continue
	print(v)


trial = int(input())
ans = []
for i in range(trial):
	(n, l, r, k) = list(map(int, input().split()))
	price = list(map(int, input().split()))
	price_new = [x for x in price if x >= l and x <= r]
	price_new.sort()
	sum = 0
	count = 0
	if len(price_new) == 0:
		ans.append(0)
	else:
		for j in price_new:
			sum += j
			if sum > k:
				break
			else:
				count += 1
		ans.append(count)
for q in ans:
	print(q)


def main():
	t = int(input())
	for _ in range(0, t):
		(n, l, r, k) = map(int, input().split(' '))
		bars = list(map(int, input().split(' ')))
		buys = []
		length = 0
		for i in range(0, n):
			if bars[i] >= l and bars[i] <= r:
				buys.append(bars[i])
				length += 1
		buys.sort()
		total = 0
		i = 0
		printed = False
		while i < length:
			if total + buys[i] > k:
				print(i)
				printed = True
				break
			else:
				total += buys[i]
			i += 1
		if total <= k and (not printed):
			print(i)
main()


t = int(input())
while t > 0:
	t -= 1
	(n, l, r, k) = list(map(int, input().split()))
	arr = list(map(int, input().split()))
	arr.sort()
	count = 0
	for i in range(0, n):
		if arr[i] >= l and arr[i] <= r:
			k -= arr[i]
			count += 1
		if k < 0:
			count -= 1
			break
	print(count)


test = int(input())
for i in range(test):
	(n, l, r, k) = map(int, input().split(' '))
	temp = list(map(int, input().split(' ')))
	temp.sort()
	s = 0
	b = 0
	index = 0
	while b < k and index < len(temp):
		if l <= temp[index] <= r and (not b + temp[index] > k):
			s += 1
			b += temp[index]
		index += 1
	print(s)


for i in range(int(input())):
	(n, l, r, k) = input().split()
	(n, l, r, k) = (int(n), int(l), int(r), int(k))
	p = sorted([int(i) for i in input().split()])
	(s, c) = (0, 0)
	for i in range(n):
		if l <= p[i] <= r and s + p[i] <= k:
			s += p[i]
			c += 1
	print(c)


for _ in range(int(input())):
	(n, l, r, k) = map(int, input().split())
	a = list(map(int, input().split()))
	a.sort()
	c = 0
	for i in range(n):
		if a[i] >= l and a[i] <= r and (k >= a[i]):
			c += 1
			k -= a[i]
	print(c)


for i in range(int(input())):
	(n, l, r, k) = map(int, input().split())
	prices = sorted([int(x) for x in input().split()])
	num_of_chocolates = 0
	for j in range(n):
		if l <= prices[j] <= r and prices[j] <= k:
			num_of_chocolates += 1
			k -= prices[j]
	print(num_of_chocolates)


m = int(input())
s = []
answers = []
ans = 0
for i in range(m):
	(n, l, r, k) = map(int, input().split())
	s = list(map(int, input().split()))
	s.sort()
	for i2 in range(n):
		if s[i2] >= l and s[i2] <= r and (k - s[i2] >= 0):
			ans += 1
			k -= s[i2]
	answers.append(ans)
	s = []
	ans = 0
for i in range(m):
	print(answers[i])


for _ in range(int(input())):
	(n, l, r, k) = map(int, input().split())
	a = sorted(map(int, input().split()))
	ans = 0
	for i in a:
		if k < i:
			break
		if l <= i <= r:
			k -= i
			ans += 1
	print(ans)


t = int(input())
for i in range(t):
	(n, l, r, k) = map(int, input().split())
	a = list(map(int, input().split()))
	v = [i for i in a if i >= l and i <= r]
	v.sort()
	si = 0
	ct = 0
	if len(v) == 0 or v[0] > k:
		print('0')
	else:
		for i in range(0, len(v)):
			if si + v[i] <= k:
				si += v[i]
				ct += 1
			else:
				break
		print(ct)


t = int(input())
for i in range(t):
	l = [int(x) for x in input().split()]
	(n, m, mx, k) = (l[0], l[1], l[2], l[3])
	arr = [int(x) for x in input().split()]
	arr.sort()
	ans = 0
	for ele in arr:
		if ele <= mx and ele >= m:
			if ele > k:
				break
			else:
				ans += 1
				k -= ele
	print(ans)


for _ in range(int(input())):
	(_, l, r, k) = map(int, input().split())
	a = list(map(int, input().split()))
	(s, m, u, ls) = (0, min(k, r), 0, [])
	for c in a:
		if c >= l and c <= m:
			s += c
			j = len(ls) - 1
			if j < 0:
				u += 1
				ls.append([c, 1])
			else:
				i = 0
				while True:
					n = (i + j) // 2
					if ls[n][0] < c:
						i = n + 1
						if i > j:
							ls.insert(i, [c, 1])
							break
					elif ls[n][0] == c:
						ls[n][1] += 1
						break
					else:
						j = n - 1
						if i > j:
							ls.insert(i, [c, 1])
							break
				if s > k:
					q = ls[-1]
					if q[1] > 1:
						q[1] -= 1
					else:
						ls.pop()
					s -= q[0]
				else:
					u += 1
			m = min(k - s + ls[-1][0], r)
	print(u)


t = int(int(input()))
list1 = []
list2 = []
for i in range(t):
	list1.append([int(x) for x in input().split()])
	list2.append([int(x) for x in input().split()])
for i in range(t):
	list2[i].sort(reverse=False)
	n = len(list2[i])
	n1 = 0
	n2 = n
	for j in range(n):
		if list1[i][1] > list2[i][j]:
			n1 = j + 1
		elif list1[i][2] < list2[i][j]:
			n2 = j
			break
	list2[i] = list2[i][n1:n2]
	m = 0
	a = 0
	while m < list1[i][3]:
		if a == len(list2[i]):
			break
		if m + list2[i][a] > list1[i][3]:
			break
		m += list2[i][a]
		a += 1
	print(a)


t = int(input())
for tt in range(t):
	(n, l, r, k) = map(int, input().split())
	a = list(map(int, input().split()))
	a.sort()
	ans = 0
	for m in a:
		if m <= k and m >= l and (m <= r):
			ans += 1
			k -= m
	print(ans)


def buy_choclate(l, r, k, prices):
	prices.sort()
	count = 0
	sum = 0
	for price in prices:
		if price < l or price > r:
			continue
		elif sum + price <= k:
			sum += price
			count += 1
	return count
test_cases = int(input())
for i in range(test_cases):
	(n, l, r, k) = map(int, input().split())
	prices = list(map(int, input().split()))
	print(buy_choclate(l, r, k, prices))


for _ in range(int(input())):
	(n, l, r, k) = map(int, input().split())
	ls = list(map(int, input().split()))
	ls.sort()
	for i in range(len(ls)):
		if ls[i] >= l:
			a = i
			break
		elif i == len(ls) - 1:
			a = 'no'
	for j in range(1, len(ls) + 1):
		if ls[-j] <= r and j == 1:
			b = len(ls)
			break
		elif ls[-j] <= r:
			b = -j + 1
			break
		elif j == len(ls):
			b = 'no'
	cost = 0
	num = 0
	if a == 'no' or b == 'no':
		print(0)
	else:
		ls = ls[a:b]
		for i in range(len(ls)):
			if cost + ls[i] <= k:
				cost += ls[i]
				num += 1
			else:
				break
		print(num)


n = int(input(''))
for i in range(n):
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	count = 0
	addive = 0
	b.sort()
	for i in range(len(b)):
		if b[i] + addive <= a[3]:
			if b[i] >= a[1] and b[i] <= a[2]:
				count += 1
				addive += b[i]
		else:
			break
	print(count)


for _ in range(int(input())):
	(n, l, r, k) = map(int, input().split())
	Arr = list(map(int, input().split()))
	Lst = []
	for i in range(n):
		if Arr[i] >= l and Arr[i] <= r:
			Lst.append(Arr[i])
	Lst.sort()
	(Sum, Count) = (0, 0)
	for i in range(len(Lst)):
		if Sum + Lst[i] > k:
			print(Count)
			break
		else:
			Sum = Sum + Lst[i]
			Count = Count + 1
	else:
		print(Count)


t = int(input())
while t > 0:
	t = t - 1
	(n, l, r, k) = map(int, input().split())
	ls = list(map(int, input().split()))
	ls = sorted(ls)
	count = 0
	for i in range(n):
		if ls[i] >= l and ls[i] <= r:
			if k > 0:
				if ls[i] <= k:
					count += 1
					k = k - ls[i]
	print(count)


for _ in range(int(input())):
	(n, l, r, k) = map(int, input().split())
	a = list(map(int, input().split()))
	s = []
	for i in a:
		if i >= l and i <= r:
			s.append(i)
	s = sorted(s)
	while sum(s) > k:
		s.pop()
	print(len(s))


for _ in range(int(input())):
	(n, l, r, k) = map(int, input().split())
	choko = list(map(int, input().split()))
	temp = choko.copy()
	for i in temp:
		if not l <= i <= r:
			choko.remove(i)
	choko.sort()
	res = 0
	i = 0
	while k > 0 and i < len(choko) and (k >= choko[i]):
		res += 1
		k -= choko[i]
		i += 1
	print(res)


t = int(input())
for i in range(t):
	(n, l, r, k) = [int(x) for x in input().split(' ')]
	a = list(map(int, input().split(' ')))
	a.sort()
	var = 0
	COUNT = 0
	for j in range(n):
		if var >= k:
			break
		if a[j] >= l:
			if a[j] <= r:
				if var + a[j] <= k:
					var += a[j]
					COUNT += 1
	print(COUNT)


for i in range(int(input())):
	(n, l, r, k) = map(int, input().split())
	a = sorted([*map(int, input().split())])
	f = 0
	for i in range(n):
		if a[i] >= l and a[i] <= r and (k - a[i] >= 0):
			k -= a[i]
			f += 1
	print(f)


for _ in range(int(input())):
	inp = list(map(int, input().split()))
	n = inp[0]
	l = inp[1]
	r = inp[2]
	k = inp[3]
	ch = list(filter(lambda c: l <= c <= r, map(int, input().split())))
	ch.sort()
	s = 0
	i = 0
	o = 0
	while s < k and i < len(ch):
		if s + ch[i] <= k:
			o += 1
			s += ch[i]
		i += 1
	print(o)


for _ in range(int(input())):
	(n, l, r, k) = [int(x) for x in input().split()]
	arr = [int(x) for x in input().split()]
	arr = filter(lambda x: x >= l, arr)
	arr = list(filter(lambda x: x <= r, arr))
	count = 0
	while len(arr) > 0:
		itr = min(arr)
		if k >= itr:
			k = k - itr
			count += 1
		else:
			break
		index = arr.index(itr)
		del arr[index]
	print(count)


t = int(input())
for i in range(t):
	(n, l, r, k) = list(map(int, input().split(' ')))
	arr = list(map(int, input().split(' ')))
	lis = []
	for i in range(n):
		if l <= arr[i] <= r:
			lis.append(arr[i])
	lis.sort()
	count = 0
	for j in range(len(lis)):
		if lis[j] > k:
			break
		k -= lis[j]
		count += 1
	print(count)