There are N cities in a row. The i-th city from the left has a sadness of A_{i}.

In an attempt to reduce the sadness of the cities, you can send [blimps] from the left of city 1 that move rightwards (i.e, a blimp crosses cities 1, 2, \ldots in order)

You are given two integers X and Y. For each blimp sent, you can make one of the following choices:
Let the blimp fly over every city, in which case the sadness of every city will decrease by Y, or,
Choose a city i (1 ≤ i ≤ N), and shower confetti over city i. In this case, the sadness of cities 1, 2, \ldots, i-1 will decrease by Y, the sadness of city i will decrease by X, and cities i+1, \ldots, N see no change in sadness.

Find the minimum number of blimps needed such that, by making the above choice optimally for each blimp, you can ensure that no city is sad (i.e, in the end every city has sadness ≤ 0).

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

- The first line of input contains a single integer T — the number of test cases. Then the test cases follow.
- The first line of each test case contains three space-separated integers N, X, Y — the size of the array, and the parameters mentioned in the statement.
- The second line of each test case contains N space-separated integers A_{1}, A_{2}, \ldots, A_{N}, denoting the sadness of the N cities.

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

For each test case, output on a new line the minimum number of blimps needed such that no city is sad.

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

$1 ≤ T ≤ 10^{4}$
$1 ≤ N ≤ 3\cdot10^{5}$
$1 ≤ X,Y ≤ 10^{9}$
$0 ≤ A_{i} ≤ 10^{9}$
- The sum of $N$ over all test cases does not exceed $3\cdot10^{5}$

----- Sample Input 1 ------ 
3
4 4 4
1 5 4 4
5 4 3
1 4 3 3 5
4 3 1
3 1 3 9
----- Sample Output 1 ------ 
2
2
3

----- explanation 1 ------ 
Test case $1$: One way of using two blimps is as follows:
- Initially, $A = [1, 5, 4, 4]$
- Shower confetti on city $2$. Now, $A = [-3, 1, 4, 4]$.
- Shower confetti on city $4$. Now, $A = [-7, -3, 0, 0]$ and we are done.

Test case $2$: One way of using two blimps is as follows:
- Initially, $A = [1, 4, 3, 3, 5]$
- Let a blimp fly over every city. Now, $A = [-2, 1, 0, 0, 2]$.
- Shower confetti on city $5$. Now, $A = [-5, -2, -3, -3, -2]$, and we are done.

Difficulty: MEDIUM_HARD
Tags: Mathematics

Starter code:

Solutions:
nTestCases = int(input())
for testCase in range(nTestCases):
	(N, X, Y) = map(int, input().split())
	citiesSadness = list(map(int, input().split()))
	maxSadness = max(citiesSadness)
	nBlimps = 0
	if Y >= X:
		if maxSadness % Y == 0:
			nBlimps = maxSadness / Y
		else:
			nBlimps = int(maxSadness / Y) + 1
	else:
		for targetCity in range(len(citiesSadness) - 1, -1, -1):
			if citiesSadness[targetCity] > 0:
				iterations = int(citiesSadness[targetCity] / X) + (citiesSadness[targetCity] % X > 0)
				citiesSadness = [citySadness - Y * iterations for citySadness in citiesSadness[:targetCity]] + [citiesSadness[targetCity] - X * iterations] + citiesSadness[targetCity + 1:]
				nBlimps += iterations
	print(nBlimps)


import math
T = int(input())
for tc in range(T):
	(n, x, y) = map(int, input().split())
	a = list(map(int, input().split()))
	scarlet = 0
	if x <= y:
		witch = max(a)
		if witch <= 0:
			print(0)
		else:
			print(math.ceil(witch / y))
	else:
		for i in range(n):
			a[i] = max(a[i], 0)
		r = 0
		for i in range(n - 1, -1, -1):
			a[i] -= r
			a[i] = max(a[i], 0)
			ak = math.ceil(a[i] / x)
			r += y * ak
			scarlet += ak
		print(scarlet)


for _ in range(int(input())):
	(n, x, y) = list(map(int, input().split()))
	sad = list(map(int, input().split()))
	if y >= x:
		maxi = max(sad)
		print(-(-maxi // y))
		continue
	total = 0
	while sad:
		a = sad.pop()
		a = max(0, a - total * y)
		total += -(-a // x)
	print(total)


import math
for _ in range(int(input())):
	(n, x, y) = map(int, input().split())
	a = list(map(int, input().split()))
	if x < y:
		x = y
	x_count = 0
	deduct = 0
	for i in range(n - 1, -1, -1):
		if a[i] - deduct <= 0:
			continue
		count = int(math.ceil((a[i] - deduct) / x))
		deduct += y * count
		x_count += count
	print(x_count)


import math
T = int(input())
for counter in range(T):
	s = input()
	s = s.split(' ')
	X = int(s[1])
	Y = int(s[2])
	if X < Y:
		X = Y
	res = 0
	a = input()
	a = a.split(' ')
	arr = []
	for i in a:
		arr.append(int(i))
	while len(arr) > 0:
		if arr[-1] <= 0:
			arr.pop()
		else:
			turns = math.ceil(arr[-1] / X)
			res += turns
			for i in range(len(arr)):
				arr[i] = arr[i] - turns * Y
			arr.pop()
	print(res)


for _ in range(int(input())):
	(n, x, y) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	if y >= x:
		print((max(a) + y - 1) // y)
		continue
	mx = [0] * n
	mx[0] = a[0]
	for i in range(1, n):
		mx[i] = max(mx[i - 1], a[i])
	res = 0
	mxOperationRequiredRight = 0
	for i in range(n - 1, -1, -1):
		operationYreq = (a[i] + y - 1) // y
		if operationYreq <= mxOperationRequiredRight:
			continue
		howManyXOperationCanDoHere = operationYreq - mxOperationRequiredRight
		left = a[i] - y * mxOperationRequiredRight
		xOpRequired = (left + x - 1) // x
		xop = min(xOpRequired, howManyXOperationCanDoHere)
		yop = max(mxOperationRequiredRight, (a[i] - x * xop + y - 1) // y)
		mxOperationRequiredRight = max(mxOperationRequiredRight, xop + yop)
	print(mxOperationRequiredRight)


from math import ceil
for _ in range(int(input())):
	(N, X, Y) = [int(i) for i in input().split(' ')]
	cities_sadness = [int(i) for i in input().split(' ')]
	if X <= Y:
		print(ceil(max(0, *cities_sadness) / Y))
	else:
		total_blimps = 0
		for i in cities_sadness[-1::-1]:
			if i > 0:
				total_blimps += ceil(max(0, i - total_blimps * Y) / X)
		print(total_blimps)


import math
for _ in range(int(input())):
	(n, x, y) = map(int, input().split())
	arr = list(map(int, input().split()))
	if x <= y:
		print(math.ceil(max(arr) / y))
		continue
	else:
		ans = 0
		for i in range(n)[::-1]:
			if arr[i] > ans * y:
				ans += math.ceil((arr[i] - ans * y) / x)
		print(ans)


import math
for i in range(int(input())):
	(n, x, y) = map(int, input().split())
	A = [int(k) for k in input().split()]
	m = max(A)
	index = A.index(m)
	Y = 0
	ans = 0
	if x < y:
		print(int(math.ceil(m / y)))
	else:
		for k in range(n - 1, -1, -1):
			if A[k] - Y > 0:
				a = int(math.ceil((A[k] - Y) / x))
				ans += a
				Y += y * a
		print(ans)


for i in range(int(input(''))):
	(n, y, x) = map(int, input().split(' '))
	list1 = list(map(int, input().split(' ')))
	if x >= y:
		if max(list1) % x != 0:
			print(max(list1) // x + 1)
		else:
			print(max(list1) // x)
	else:
		if list1[-1] % y != 0:
			a = list1[-1] // y + 1
		else:
			a = list1[-1] // y
		for j in range(2, n + 1):
			c = list1[-j] - x * a
			if c > 0:
				if c % y != 0:
					a = a + 1 + c // y
				else:
					a = a + c // y
		print(a)


import math
for _ in range(int(input())):
	(cities_num, shower_power, fly_power) = [int(num) for num in input().split()]
	sadness = [int(num) for num in input().split()]
	if not any(sadness):
		print(0)
		continue
	if shower_power <= fly_power:
		print(math.ceil(max(sadness) / fly_power))
		continue
	blimps_num = 0
	for i in range(cities_num - 1, -1, -1):
		sadness[i] -= blimps_num * fly_power
		if sadness[i] <= fly_power:
			continue
		blimps_delta = sadness[i] // shower_power
		if i < cities_num - 1 and sadness[i] % shower_power > fly_power:
			blimps_delta += 1
		elif i == cities_num - 1 and sadness[i] % shower_power == 0:
			blimps_delta -= 1
		sadness[i] -= blimps_delta * shower_power
		blimps_num += blimps_delta
	print(blimps_num + 1)


t = int(input())
for j in range(t):
	(n, x, y) = map(int, input().split())
	lst = list(map(int, input().split()))
	if x > y:
		cnt = 0
		for i in reversed(range(0, n)):
			lst[i] -= cnt * y
			if lst[i] < 0:
				continue
			req = (lst[i] + x - 1) // x
			cnt += req
		print(cnt)
	else:
		print((max(lst) + y - 1) // y)


import sys
from math import *
from itertools import *
from bisect import bisect, bisect_left
from collections import deque, Counter, defaultdict as dd
mod = 10 ** 9 + 7

def input():
	return sys.stdin.readline().rstrip('\r\n')

def ri():
	return int(input())

def rl():
	return list(map(int, input().split()))

def rls():
	return list(map(str, input().split()))

def rm():
	return map(int, input().split())

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def lcm(x, y):
	return x * y // gcd(x, y)

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def d2b(n):
	s = bin(n).replace('0b', '')
	return (34 - len(s)) * '0' + s
for _ in range(ri()):
	(n, x, y) = rm()
	a = rl()
	if x <= y:
		ans = ceil(max(a) / y)
	else:
		ans = 0
		for i in range(n - 1, -1, -1):
			a[i] -= y * ans
			a[i] = max(a[i], 0)
			ans = max(ans, ans + ceil(a[i] / x))
	print(ans)


import math
t = int(input())
for x in range(t):
	(n, x, y) = map(int, input().split())
	seq = list(map(int, input().split()))
	if x > y:
		blimps = 0
		for i in range(n - 1, -1, -1):
			seq[i] = seq[i] - blimps * y
			if seq[i] > 0:
				req = math.ceil(seq[i] / x)
				blimps += req
		print(blimps)
	else:
		print(math.ceil(max(seq) / y))


for _ in range(int(input())):
	(n, x, y) = map(int, input().split())
	arr = list(map(int, input().split()))
	ans = 0
	if x <= y:
		for i in arr:
			ans = max(ans, (i + y - 1) // y)
		print(ans)
	else:
		for i in range(n - 1, -1, -1):
			arr[i] -= y * ans
			arr[i] = max(0, arr[i])
			ans = max(ans, ans + (arr[i] + x - 1) // x)
		print(ans)


import math
case = int(input())
for _ in range(case):
	(n, x, y) = map(int, input().split(' '))
	arr = list(map(int, input().split(' ')))
	if y >= x:
		curr_max = arr[0]
		for i in range(1, n):
			if arr[i] > curr_max:
				curr_max = arr[i]
		ans = math.ceil(curr_max / y)
	else:
		i = n - 1
		ans = 0
		changed = False
		while i > -1:
			arr[i] -= ans * y
			if arr[i] > 0:
				ans += math.ceil(arr[i] / x)
			i -= 1
	print(ans)


from math import ceil
for t in range(int(input())):
	(n, x, y) = map(int, input().split())
	l = list(map(int, input().split()))
	maxi = max(l)
	if y >= x:
		ans = ceil(maxi / y)
		print(ans)
	else:
		ans = 0
		for i in range(n - 1, -1, -1):
			l[i] -= ans * y
			if l[i] > 0:
				ans += ceil(l[i] / x)
		print(ans)


for case in range(int(input())):
	(n, x, y) = map(int, input().strip().split())
	arr = list(map(int, input().strip().split()))
	blimps = 0
	i = len(arr)
	while i > 0:
		i -= 1
		sadness = arr[i] - blimps * y
		if sadness <= 0:
			continue
		(sx, sy) = (sadness / x, sadness / y)
		if sx <= sy:
			blimps += int(sx) + (1 if int(sx) != sx else 0)
		else:
			blimps += int(sy) + (1 if int(sy) != sy else 0)
	print(blimps)
	pass


import math
for _ in range(int(input())):
	(n, x, y) = list(map(int, input().split()))
	l = list(map(int, input().split()))
	if y >= x:
		m = max(l)
		print(math.ceil(m / y))
	else:
		cnt = 0
		for z in range(n - 1, -1, -1):
			l[z] = l[z] - cnt * y
			if l[z] > 0:
				cnt = cnt + math.ceil(l[z] / x)
		print(cnt)


from math import ceil
from posixpath import split
for _ in range(0, int(input())):
	(n, x, y) = map(int, input().split())
	a = list(map(int, input().split()))[:n]
	ans = 0
	if x <= y:
		ans = ceil(max(a) / y)
	else:
		for i in range(n - 1, -1, -1):
			a[i] = a[i] - y * ans
			if a[i] > 0:
				ans += ceil(a[i] / x)
	print(ans)


from math import ceil
for _ in range(int(input())):
	(n, x, y) = map(int, input().split())
	l = list(map(int, input().split()))
	(op1, op2) = (0, 0)
	for i in range(1, n + 1):
		l[-i] -= (op1 + op2) * y
		if l[-i] > 0:
			if x >= y:
				cal = ceil(l[-i] / x)
				op2 += cal
				l[-i] -= cal * y
			else:
				cal = ceil(l[-i] / y)
				op1 += cal
				l[-i] -= cal * y
	print(op1 + op2)


import math
T = int(input())
while T:
	(n, x, y) = map(int, input().split())
	l = list(map(int, input().split()))
	if y >= x:
		m = max(l)
		print(math.ceil(m / y))
	else:
		op = 0
		for i in range(n - 1, -1, -1):
			ele = l[i] - op * y
			if ele > 0:
				op += math.ceil(ele / x)
		print(op)
	T = T - 1


import math
n = int(input())
for z in range(n):
	(size, x, y) = map(int, input().split())
	arr = [int(i) for i in input().split()]
	x = int(x)
	y = int(y)
	size = int(size)
	if y >= x:
		m = max(arr)
		count = math.ceil(m / y)
		print(count)
	else:
		count = 0
		for i in range(size - 1, -1, -1):
			temp = arr[i]
			temp = temp - count * y
			if temp > 0:
				curr = math.ceil(temp / x)
				count += curr
		print(count)


import math
t = int(input())
while t > 0:
	(n, x, y) = map(int, input().split())
	a = list(map(int, input().split()))
	if y >= x:
		print(math.ceil(max(a) / y))
	else:
		ans = 0
		for i in range(1, len(a) + 1):
			a[-i] = a[-i] - ans * y
			if a[-i] > 0:
				ans = ans + math.ceil(a[-i] / x)
		print(ans)
	t = t - 1


import math
for _ in range(int(input())):
	(n, x, y) = map(int, input().rstrip().split())
	lst = list(map(int, input().rstrip().split()))
	if x <= y:
		print(math.ceil(max(lst) / y))
		continue
	temp = lst
	total_blimps = 0
	for i in range(n - 1, -1, -1):
		lst[i] -= total_blimps * y
		if lst[i] > 0:
			total_blimps += math.ceil(lst[i] / x)
	print(total_blimps)


import math

def solve(num, x, y, l):
	if y >= x:
		return math.ceil(max(l) / y)
	else:
		count = 0
		i = len(l) - 1
		while i >= 0:
			l[i] = l[i] - count * y
			if l[i] > 0:
				count = count + math.ceil(l[i] / x)
			i = i - 1
		return count

def second(l, x, y, i):
	for j in range(0, i):
		l[j] = l[j] - y
	l[i] = l[i] - x
	return l

def first(l, x, y):
	for i in range(0, len(l)):
		l[i] -= y
	return l

def check(l):
	for i in l:
		if i > 0:
			return False
	return True
n = int(input())
results = []
for i in range(0, n):
	(num, x, y) = map(int, input().split())
	l = list(map(int, input().split()))
	out = solve(num, x, y, l)
	results.append(out)
for j in results:
	print(j)


from math import ceil
for _ in range(int(input())):
	(n, x, y) = map(int, input().split())
	l = [int(x) for x in input().split()]
	if x <= y:
		print(ceil(max(l) / y))
	else:
		ans = 0
		temp = 0
		for i in range(n - 1, -1, -1):
			newNo = l[i] - temp
			if newNo > 0:
				z = ceil(newNo / x)
				temp += z * y
				ans += z
		print(ans)


from sys import stdin
input = stdin.readline
from math import ceil, floor, sqrt, log2
from heapq import heappush, heappop
from collections import deque
from functools import lru_cache
from bisect import bisect_left, bisect_right

def rl(t=int):
	return list(map(t, input().split()))
T = int(input())
for t in range(1, T + 1):
	(n, x, y) = rl()
	a = rl()
	if x <= y:
		print(ceil(max(a) / y))
		continue
	dec = 0
	ret = 0
	for i in range(n - 1, -1, -1):
		val = max(0, a[i] - dec)
		div = ceil(val / x)
		ret += div
		dec += div * y
	print(ret)


for _ in range(int(input())):
	(n, x, y) = map(int, input().split())
	a = list(map(int, input().split()))
	if x <= y:
		l = max(a)
		print(l // y if l % y == 0 else l // y + 1)
	else:
		sum = 0
		for i in range(n - 1, -1, -1):
			if a[i] <= 0:
				continue
			no = a[i] // x if a[i] % x == 0 else a[i] // x + 1
			for j in range(i):
				a[j] -= no * y
			a[i] -= no * x
			sum += no
		print(sum)


for _ in range(int(input())):
	(n, x, y) = map(int, input().split())
	a = list(map(int, input().split()))
	if x < y:
		print((max(a) + y - 1) // y)
		continue
	ans = 0
	for i in reversed(range(0, n)):
		a[i] -= ans * y
		if a[i] <= 0:
			continue
		reqd = (a[i] + x - 1) // x
		ans += reqd
	print(ans)


test = int(input())
while test:
	test -= 1
	(n, x, y) = map(int, input().split())
	arr = list(map(int, input().split()))
	maximum = max(arr)
	if x <= y:
		ans = (maximum + y - 1) // y
	else:
		ans = 0
		for i in range(n - 1, -1, -1):
			arr[i] = arr[i] - ans * y
			if arr[i] > 0:
				ans += (arr[i] + x - 1) // x
	print(ans)


import math
T = int(input())
for _ in range(T):
	(N, X, Y) = list(map(int, input().split()))
	A = list(map(int, input().split()))
	if X <= Y:
		print(math.ceil(max(A) / Y))
	else:
		Yarr = [0] * N
		for i in range(N):
			Yarr[i] = math.ceil(A[i] / Y)
		blimps = math.ceil(A[N - 1] / X)
		for i in range(N - 2, -1, -1):
			if A[i] >= blimps * Y:
				val = math.ceil((A[i] - blimps * Y) / X)
				blimps += val
			else:
				continue
		print(blimps)


import math
f = int(input())
for q in range(f):
	(n, x, y) = [int(o) for o in input().split()]
	l = [int(o) for o in input().split()]
	k = l
	c = 0
	if x <= y:
		z = max(l)
		z = math.ceil(z / y)
		print(z)
	else:
		for i in k[::-1]:
			o = i - c * y
			if o > 0:
				z = math.ceil(o / x)
				c += z
		print(c)


for _ in range(int(input())):
	(n, x, y) = map(int, input().split())
	A = list(map(int, input().split()))
	sol = 0
	if y >= x:
		m = A[0]
		for i in range(n):
			if A[i] > m:
				m = A[i]
		sol = m // y + (1 if m % y else 0)
	else:
		for a in A[::-1]:
			a = a - sol * y
			if a <= 0:
				continue
			a = a // x + (1 if a % x else 0)
			sol += a
	print(sol)


import math
for _ in range(int(input())):
	(n, x, y) = map(int, input().split(' '))
	l = list(map(int, input().split(' ')))
	m = max(l)
	res = 0
	if y >= x:
		res = math.ceil(m / y)
	else:
		for i in range(len(l) - 1, -1, -1):
			new_sad = l[i] - res * y
			if new_sad <= 0:
				continue
			res += math.ceil(new_sad / x)
	print(res)


from math import ceil
for _ in range(int(input())):
	(n, x, y) = map(int, input().split())
	l = list(map(int, input().split()))
	moves = 0
	if x <= y:
		print(ceil(max(l) / y))
	else:
		for i in range(n - 1, -1, -1):
			new_sad = l[i] - moves * y
			if new_sad <= 0:
				continue
			moves += ceil(new_sad / x)
		print(moves)


import math
t = int(input())
for _ in range(t):
	(n, x, y) = [int(i) for i in input().split()]
	a = [int(i) for i in input().split()]
	m = max(a)
	ans = 0
	if x <= y:
		ans = math.ceil(m / y)
		print(ans)
		continue
	for i in range(n - 1, -1, -1):
		a[i] -= ans * y
		if a[i] <= 0:
			continue
		count = math.ceil(a[i] / x)
		ans += count
	print(ans)


T = int(input())
for t in range(T):
	(n, x, y) = map(int, input().split())
	arr = [int(_) for _ in input().split()]
	maxm = max(arr)
	sub = 0
	if y >= x:
		print(max(0, (maxm + y - 1) // y))
	else:
		ans = 0
		for i in range(n - 1, -1, -1):
			arr[i] -= ans * y
			if arr[i] > 0:
				ans += (arr[i] + x - 1) // x
		print(ans)


for _ in range(int(input())):
	(N, x, Y) = list(map(int, input().split()))
	arr = list(map(int, input().split()))
	if Y >= x:
		print((max(arr) + Y - 1) // Y)
		continue
	var = [0] * N
	var[0] = arr[0]
	for i in range(1, N):
		var[i] = max(var[i - 1], arr[i])
	RES = 0
	OPright = 0
	for i in range(N - 1, -1, -1):
		OpY = (arr[i] + Y - 1) // Y
		if OpY <= OPright:
			continue
		countX = OpY - OPright
		L = arr[i] - Y * OPright
		OpX = (L + x - 1) // x
		XopCheck = min(OpX, countX)
		YopCheck = max(OPright, (arr[i] - x * XopCheck + Y - 1) // Y)
		OPright = max(OPright, XopCheck + YopCheck)
	print(OPright)


def fn(n, x, y, arr):
	if x <= y:
		return math.ceil(max(arr) / y)
	else:
		total_blimps = 0
		for i in range(n - 1, -1, -1):
			arr[i] = max(0, arr[i] - total_blimps * y)
			if arr[i] <= 0:
				continue
			total_blimps += math.ceil(arr[i] / x)
		return total_blimps
import math
t = int(input())
for T in range(t):
	(n, x, y) = map(int, input().split())
	arr = [int(x) for x in input().split()]
	ans = fn(n, x, y, arr)
	print(ans)


import math

def rec(l, x, y):
	l.reverse()
	j = 0
	k = 0
	for i in l:
		if i > j:
			m = int(math.ceil((i - j) / x))
			k += m
			j += m * y
	return k
for _ in range(int(input())):
	(n, x, y) = map(int, input().split())
	l = list(map(int, input().split()))
	if x <= y:
		m = max(l)
		print(math.ceil(m / y))
	else:
		k = rec(l, x, y)
		print(k)


import copy
import math
from collections import Counter, defaultdict, deque
from queue import PriorityQueue
from bisect import bisect_left, bisect_right
mod = 10 ** 9 + 7

def get_factor(num):
	factors = []
	limit = int(math.sqrt(num)) + 1
	for i in range(1, limit):
		if num % i == 0:
			factors.append(i)
	return factors

def integer_list():
	return list(map(int, input().split()))

def string_list():
	return list(map(str, input().split()))

def hetro_list():
	return list(input().split())

def pprint(matrix):
	for i in range(len(matrix)):
		print(*matrix[i])
t = int(input())
for _ in range(t):
	(n, x, y) = integer_list()
	lst = integer_list()
	if x <= y:
		max_num = max(lst)
		b_f_last = math.ceil(max_num / y)
		print(int(b_f_last))
	else:
		already = 0
		count = 0
		while lst:
			ele = lst.pop()
			if ele - already <= 0:
				continue
			b_f_last = int(math.ceil((ele - already) / x))
			count += int(b_f_last)
			already += y * b_f_last
		print(count)


import math
T = int(input())
for _ in range(T):
	(N, X, Y) = map(int, input().split())
	A = list(map(int, input().split()))
	res = 0
	maxSadness = max(A)
	if Y >= X:
		print(math.ceil(maxSadness / Y))
	else:
		for i in range(N - 1, -1, -1):
			A[i] -= res * Y
			if A[i] <= 0:
				continue
			confettiShowers = math.ceil(A[i] / X)
			res += confettiShowers
		print(res)


import math
for _ in range(int(input())):
	(n, x, y) = map(int, input().strip().split())
	sadness = list(map(int, input().strip().split()))
	if x <= y:
		totalBlimp = math.ceil(max(sadness) / y)
		print(totalBlimp)
	else:
		totalBlimp = 0
		for idx in range(n - 1, -1, -1):
			if sadness[idx] <= 0:
				continue
			multipleRound = math.ceil(sadness[idx] / x)
			totalBlimp += multipleRound
			sadness[idx] -= multipleRound * x
			for i in range(0, idx):
				sadness[i] -= multipleRound * y
		print(totalBlimp)


import math as m
import numpy as np
t = int(input())
for i in range(t):
	(n, x, y) = map(int, input().split())
	a = list(map(int, input().split()))
	s = 0
	if y >= x:
		print(m.ceil(max(a) / y))
	else:
		a1 = np.array(a)
		while max(a1) > 0:
			b = max(filter(lambda x: a1[x] > 0, range(len(a1))))
			z = m.ceil(a1[b] / x)
			a1[:b] = a1[:b] - z * y
			a1[b] = a1[b] - z * x
			s = s + z
		print(s)


import math
for _ in range(int(input())):
	(n, x, y) = map(int, input().split())
	arr = [int(i) for i in input().split()]
	if y >= x:
		mx = max(arr)
		ans = math.ceil(mx / y)
		print(int(ans))
	else:
		s = 0
		times = 0
		for i in range(n - 1):
			times = math.ceil(max(0, arr[n - i - 1] - s * y) / x)
			arr[n - i - 1] = int(times)
			s += int(times)
		times = math.ceil(max(0, arr[0] - s * y) / x)
		arr[0] = int(times)
		ans = sum(arr)
		print(ans)


import math
t = int(input())
for i in range(t):
	(n, x, y) = map(int, input().split())
	a = list(map(int, input().split()))
	m = max(a)
	if x <= y:
		print(int(math.ceil(m / y)))
	else:
		c = 0
		for i in reversed(range(n)):
			d = a[i] - c * y
			if d > 0:
				c = c + int(math.ceil(d / x))
		print(c)


import math
t = int(input())
while t:
	s = input().split()
	(n, x, y) = map(int, s)
	s = input().split()
	arr = list(map(int, s))
	maxval = max(arr)
	if y >= x:
		print(int(math.ceil(maxval / y)))
		t -= 1
		continue
	count = 0
	for i in range(n - 1, -1, -1):
		cur = arr[i] - count * y
		if cur > 0:
			count += int(math.ceil(cur / x))
	print(count)
	t -= 1


for _ in range(int(input())):
	(n, x, y) = map(int, input().split())
	a = [int(x) for x in input().split()]
	if x <= y:
		ans = max(a) // y
		if max(a) % y != 0:
			ans += 1
		print(ans)
	else:
		c = 0
		for i in range(n - 1, -1, -1):
			a[i] -= c * y
			if a[i] <= 0:
				continue
			reqd = (a[i] + x - 1) // x
			c += reqd
		print(c)


import math

def ans(arr, n, x, y):
	if x <= y:
		return math.ceil(max(arr) / y)
	else:
		steps = 0
		i = n - 1
		while i >= 0:
			arr[i] -= steps * y
			if arr[i] > 0:
				steps += math.ceil(arr[i] / x)
			i -= 1
		return steps
test_cases = int(input())
while test_cases != 0:
	d = list(map(int, input().split()))
	d2 = list(map(int, input().split()))
	print(ans(d2, d[0], d[1], d[2]))
	test_cases -= 1


import math

def blimp():
	(n, x, y) = map(int, input().split())
	l = list(map(int, input().split()))
	if y >= x:
		m = max(l)
		print(math.ceil(m / y))
		return
	else:
		i = n - 1
		c = math.ceil(l[n - 1] / x)
		count = c
		for i in range(n - 2, -1, -1):
			l[i] = l[i] - count * y
			if l[i] > 0:
				c = math.ceil(l[i] / x)
				count += c
		print(count)
		return
t = int(input())
while t:
	blimp()
	t -= 1


from math import ceil
for T in range(int(input())):
	(N, X, Y) = map(int, input().split())
	A = list(map(int, input().split()))
	if X <= Y:
		print((max(A) + (Y - 1)) // Y)
	else:
		c = 0
		ans = 0
		for i in range(N - 1, -1, -1):
			A[i] -= c * Y
			if A[i] > 0:
				d = (A[i] + (X - 1)) // X
				ans += d
				c += d
		print(ans)


from math import ceil
for i in range(int(input())):
	(n, x, y) = map(int, input().split())
	l = list(map(int, input().split()))
	count = 0
	if y >= x:
		if max(l) % y == 0:
			print(max(l) // y)
		else:
			print(max(l) // y + 1)
	else:
		while True:
			if l[n - 1] > 0:
				count += ceil(l[n - 1] / x)
				l[n - 1] -= count * x
			else:
				n -= 1
				if n != 0:
					l[n - 1] -= count * y
			if n == 0:
				break
		print(count)


from math import ceil
for _ in range(int(input())):
	(n, x, y) = [int(x) for x in input().split()]
	a = [int(x) for x in input().split()]
	if y >= x:
		print(ceil(max(a) / y))
		continue
	total_blimps = 0
	for i in range(n - 1, -1, -1):
		a[i] = max(0, a[i] - total_blimps * y)
		total_blimps += ceil(a[i] / x)
	print(total_blimps)


import sys
from xml.etree.ElementPath import xpath_tokenizer_re
for _ in range(int(sys.stdin.readline())):
	(n, x, y) = map(int, sys.stdin.readline().split())
	a = [int(i) for i in sys.stdin.readline().split()]
	if y >= x:
		ans1 = 0
		if max(a) % y == 0:
			ans1 = max(a) // y
		elif max(a) % y != 0:
			ans1 = max(a) // y + 1
		print(ans1)
	else:
		ans = 0
		for i in reversed(range(0, n)):
			a[i] -= y * ans
			if a[i] <= 0:
				continue
			temp = (a[i] + x - 1) // x
			ans += temp
		print(ans)


for i in range(int(input())):
	input_list = input().split()
	n = int(input_list[0])
	last_city = int(input_list[1])
	every_city = int(input_list[2])
	sadness_list = [None] * n
	sadness_string = input().split()
	maxi = 0
	for i in range(n):
		sadness_list[i] = int(sadness_string[i])
		if sadness_list[i] > maxi:
			maxi = sadness_list[i]
	if every_city >= last_city:
		if maxi % every_city == 0:
			print(maxi // every_city)
		else:
			print(maxi // every_city + 1)
	else:
		count = 0
		for i in reversed(range(n)):
			sadness_list[i] -= count * every_city
			if sadness_list[i] < 0:
				continue
			else:
				if sadness_list[i] % last_city == 0:
					temp_count = sadness_list[i] // last_city
				else:
					temp_count = sadness_list[i] // last_city + 1
				sadness_list[i] -= temp_count * last_city
				count += temp_count
		print(count)


from math import ceil
test_cases = int(input(''))
answer = []
for i in range(test_cases):
	(n, x, y) = map(int, input().split())
	arr = list(map(int, input().split()))
	(s, flag) = (0, True)
	if y >= x:
		answer.append(ceil(max(arr) / y))
		continue
	else:
		count = 0
		for j in range(n - 1, -1, -1):
			temp = arr[j] - y * count
			if temp <= 0:
				continue
			else:
				count += ceil(temp / x)
		answer.append(count)
for ans in answer:
	print(ans)


t = int(input())
import math
for i in range(t):
	(n, x, y) = map(int, input().split())
	l = list(map(int, input().split()))
	if y >= x:
		print(math.ceil(max(l) / y))
		continue
	else:
		c = 0
		for i in range(n - 1, -1, -1):
			a = l[i] - y * c
			if a > 0:
				c += math.ceil(a / x)
		print(c)


import math
t = int(input())
for i in range(t):
	(n, x, y) = input().split()
	(n, x, y) = (int(n), int(x), int(y))
	a = list(map(int, input().split()))
	if n == 1:
		print(math.ceil(a[0] / max(x, y)))
		continue
	if y >= x:
		maxVal = max(a)
		print(math.ceil(maxVal / y))
	else:
		ans = 0
		for r in range(n - 1, -1, -1):
			a[r] -= y * ans
			a[r] = max(0, a[r])
			ans = max(ans, ans + math.ceil(a[r] / x))
		print(ans)


import math
t = int(input())

def findLargest(arr):
	second = 0
	largest = min(arr)
	for i in range(len(arr)):
		if arr[i] > largest:
			second = largest
			largest = i
		else:
			second = i if arr[i] > arr[second] else second
	return [largest, second]
for i in range(t):
	(n, x, y) = input().split()
	(n, x, y) = (int(n), int(x), int(y))
	a = list(map(int, input().split()))
	if n == 1:
		print(math.ceil(a[0] / max(x, y)))
		continue
	if y >= x:
		maxVal = max(a)
		print(math.ceil(maxVal / y))
	else:
		ans = 0
		for r in range(n - 1, -1, -1):
			a[r] -= y * ans
			a[r] = max(0, a[r])
			ans = max(ans, ans + math.ceil(a[r] / x))
		print(ans)


t = int(input())
for _ in range(t):
	(n, x, y) = [int(x) for x in input().split()]
	A = [int(x) for x in input().split()]
	if x <= y:
		res = (max(A) + y + -1) // y
		print(res)
	elif max(A) <= y:
		print(1)
	else:
		carry = 0
		for i in range(len(A) - 1, -1, -1):
			A[i] = A[i] - carry * y
			if A[i] > y:
				(a, b) = divmod(A[i], x)
				carry += a
				if b > y:
					carry += 1
					A[i] = 0
				else:
					A[i] = b
		for i in range(len(A)):
			if A[i] > 0:
				carry += 1
				break
		print(carry)


from math import inf
from collections import *
import math, os, sys, heapq, bisect, random, threading
from functools import lru_cache
from itertools import *

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def inpu():
	return int(inp())

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def fsep():
	return map(float, inp().split())
(M, M1) = (1000000007, 998244353)

def main():
	how_much_noob_I_am = 1
	how_much_noob_I_am = inpu()
	for _ in range(how_much_noob_I_am):
		(n, x, y) = map(int, input().split())
		arr = list(map(int, input().split()))
		if x < y:
			x = y
		if arr.count(0) == n:
			print(0)
			continue
		ans = 0
		prev = 0
		for i in range(n - 1, -1, -1):
			arr[i] = arr[i] - prev * y
			if arr[i] <= 0:
				continue
			if arr[i] > y:
				p = (arr[i] + x - 1) // x
				prev += p
				ans += p
			else:
				ans += 1
				prev += 1
		print(ans)
main()


test = int(input())
for t in range(test):
	(n, x, y) = map(int, input().split())
	A = list(map(int, input().split()))
	if y >= x:
		print((max(A) + y - 1) // y)
		continue
	B = [0] * n
	B[0] = A[0]
	for i in range(1, n):
		B[i] = max(B[i - 1], A[i])
	out = 0
	mix = 0
	for i in range(n - 1, -1, -1):
		o = (A[i] + y - 1) // y
		if o <= mix:
			continue
		h = o - mix
		l = A[i] - y * mix
		xof = (l + x - 1) // x
		x1 = min(xof, h)
		y1 = max(mix, (A[i] - x * x1 + y - 1) // y)
		mix = max(mix, x1 + y1)
	print(mix)


import math
T = int(input())
for tc in range(T):
	(n, x, y) = map(int, input().split())
	arr = list(map(int, input().split()))
	scarlet = 0
	if x <= y:
		witch = max(arr)
		if witch <= 0:
			print(0)
		else:
			print(math.ceil(witch / y))
	else:
		for i in range(n):
			arr[i] = max(arr[i], 0)
		raja = 0
		for i in range(n - 1, -1, -1):
			arr[i] -= raja
			arr[i] = max(arr[i], 0)
			akbar = math.ceil(arr[i] / x)
			raja += y * akbar
			scarlet += akbar
		print(scarlet)


import math
t = int(input())
for tc in range(t):
	(n, x, y) = map(int, input().split())
	arr = list(map(int, input().split()))
	var2 = 0
	if x <= y:
		var1 = max(arr)
		if var1 <= 0:
			print(0)
		else:
			print(math.ceil(var1 / y))
	else:
		for i in range(n):
			arr[i] = max(arr[i], 0)
		var4 = 0
		for i in range(n - 1, -1, -1):
			arr[i] -= var4
			arr[i] = max(arr[i], 0)
			var3 = math.ceil(arr[i] / x)
			var4 += y * var3
			var2 += var3
		print(var2)