You are an environmental activist at heart but the reality is harsh and you are just a cashier in a cinema. But you can still do something!

You have $n$ tickets to sell. The price of the $i$-th ticket is $p_i$. As a teller, you have a possibility to select the order in which the tickets will be sold (i.e. a permutation of the tickets). You know that the cinema participates in two ecological restoration programs applying them to the order you chose:  The $x\%$ of the price of each the $a$-th sold ticket ($a$-th, $2a$-th, $3a$-th and so on) in the order you chose is aimed for research and spreading of renewable energy sources.  The $y\%$ of the price of each the $b$-th sold ticket ($b$-th, $2b$-th, $3b$-th and so on) in the order you chose is aimed for pollution abatement. 

If the ticket is in both programs then the $(x + y) \%$ are used for environmental activities. Also, it's known that all prices are multiples of $100$, so there is no need in any rounding.

For example, if you'd like to sell tickets with prices $[400, 100, 300, 200]$ and the cinema pays $10\%$ of each $2$-nd sold ticket and $20\%$ of each $3$-rd sold ticket, then arranging them in order $[100, 200, 300, 400]$ will lead to contribution equal to $100 \cdot 0 + 200 \cdot 0.1 + 300 \cdot 0.2 + 400 \cdot 0.1 = 120$. But arranging them in order $[100, 300, 400, 200]$ will lead to $100 \cdot 0 + 300 \cdot 0.1 + 400 \cdot 0.2 + 200 \cdot 0.1 = 130$.

Nature can't wait, so you decided to change the order of tickets in such a way, so that the total contribution to programs will reach at least $k$ in minimum number of sold tickets. Or say that it's impossible to do so. In other words, find the minimum number of tickets which are needed to be sold in order to earn at least $k$.


-----Input-----

The first line contains a single integer $q$ ($1 \le q \le 100$) — the number of independent queries. Each query consists of $5$ lines.

The first line of each query contains a single integer $n$ ($1 \le n \le 2 \cdot 10^5$) — the number of tickets.

The second line contains $n$ integers $p_1, p_2, \dots, p_n$ ($100 \le p_i \le 10^9$, $p_i \bmod 100 = 0$) — the corresponding prices of tickets.

The third line contains two integers $x$ and $a$ ($1 \le x \le 100$, $x + y \le 100$, $1 \le a \le n$) — the parameters of the first program.

The fourth line contains two integers $y$ and $b$ ($1 \le y \le 100$, $x + y \le 100$, $1 \le b \le n$) — the parameters of the second program.

The fifth line contains single integer $k$ ($1 \le k \le 10^{14}$) — the required total contribution.

It's guaranteed that the total number of tickets per test doesn't exceed $2 \cdot 10^5$.


-----Output-----

Print $q$ integers — one per query. 

For each query, print the minimum number of tickets you need to sell to make the total ecological contribution of at least $k$ if you can sell tickets in any order.

If the total contribution can not be achieved selling all the tickets, print $-1$.


-----Example-----
Input
4
1
100
50 1
49 1
100
8
100 200 100 200 100 200 100 100
10 2
15 3
107
3
1000000000 1000000000 1000000000
50 1
50 1
3000000000
5
200 100 100 100 100
69 5
31 2
90

Output
-1
6
3
4



-----Note-----

In the first query the total contribution is equal to $50 + 49 = 99 < 100$, so it's impossible to gather enough money.

In the second query you can rearrange tickets in a following way: $[100, 100, 200, 200, 100, 200, 100, 100]$ and the total contribution from the first $6$ tickets is equal to $100 \cdot 0 + 100 \cdot 0.1 + 200 \cdot 0.15 + 200 \cdot 0.1 + 100 \cdot 0 + 200 \cdot 0.25 = 10 + 30 + 20 + 50 = 110$.

In the third query the full price of each ticket goes to the environmental activities.

In the fourth query you can rearrange tickets as $[100, 200, 100, 100, 100]$ and the total contribution from the first $4$ tickets is $100 \cdot 0 + 200 \cdot 0.31 + 100 \cdot 0 + 100 \cdot 0.31 = 62 + 31 = 93$.

Difficulty: MEDIUM_HARD
Tags: Sorting

Greedy algorithms
Skill types: Sorting

Greedy algorithms

Starter code:

Solutions:
from math import gcd
for step in range(int(input())):
	n = int(input())
	P = [int(i) // 100 for i in input().split()]
	(x, a) = map(int, input().split())
	(y, b) = map(int, input().split())
	k = int(input())
	z = x + y
	c = a * b // gcd(a, b)
	P.sort(reverse=True)
	if x < y:
		(x, y, a, b) = (y, x, b, a)
	(l, r) = (-1, len(P) + 1)
	while r - l > 1:
		m = (l + r) // 2
		(w, ans) = (m // c, 0)
		for q in range(w):
			ans += P[q] * z
		for q in range(w, m // a):
			ans += P[q] * x
		for q in range(m // a, m // a + m // b - w):
			ans += P[q] * y
		if ans >= k:
			r = m
		else:
			l = m
	if r == len(P) + 1:
		print(-1)
	else:
		print(r)


import math
import sys
sys.setrecursionlimit(1000000)

def lcm(a, b):
	return a * b // math.gcd(a, b)

def f(prices, x, a, y, b, i):
	Nab = i // lcm(a, b)
	Na = i // a - Nab
	Nb = i // b - Nab
	result = 0
	result2 = (sum(prices[:Nab]) * (x + y) + sum(prices[Nab:Nab + Na]) * x + sum(prices[Nab + Na:Nab + Na + Nb]) * y) // 100
	for i in range(len(prices)):
		if Nab > 0:
			result += (x + y) * (prices[i] // 100)
			Nab -= 1
		elif Na > 0:
			result += x * (prices[i] // 100)
			Na -= 1
		elif Nb > 0:
			result += y * (prices[i] // 100)
			Nb -= 1
		if Nab == 0 and Na == 0 and (Nb == 0):
			break
	return result

def BS(left, right):
	global prices, x, a, y, b
	mid = (left + right) // 2
	res = f(prices, x, a, y, b, mid)
	if right - left <= 1:
		return -1
	if res < k:
		return BS(mid, right)
	elif res >= k:
		if f(prices, x, a, y, b, mid - 1) >= k:
			return BS(left, mid - 1)
		else:
			return mid
q = int(input())
results = []
for j in range(q):
	n = int(input())
	prices = [int(i) for i in input().split()]
	prices.sort(reverse=True)
	xa = [int(i) for i in input().split()]
	yb = [int(i) for i in input().split()]
	k = int(input())
	mass = [xa, yb]
	mass = sorted(mass, key=lambda a: a[0], reverse=True)
	x = mass[0][0]
	a = mass[0][1]
	y = mass[1][0]
	b = mass[1][1]
	left_b = 0
	right_b = n + 1
	while right_b - left_b > 1:
		mid = (right_b + left_b) // 2
		if f(prices, x, a, y, b, mid) >= k:
			right_b = mid
		else:
			left_b = mid
	if right_b > n:
		results.append(-1)
	else:
		results.append(right_b)
for q in results:
	print(q)


import math

def f(m):
	global a, b, x, y
	f = m // (a * b // math.gcd(a, b))
	w = m // a - f
	e = m // b - f
	t = 0
	for i in range(f):
		t += x * p[i] // 100
		t += y * p[i] // 100
	for i in range(f, f + w):
		t += x * p[i] // 100
	for i in range(w + f, e + w + f):
		t += y * p[i] // 100
	return t
q = int(input())
for i in range(q):
	n = int(input())
	p = [int(i) for i in input().split()]
	(x, a) = [int(i) for i in input().split()]
	(y, b) = [int(i) for i in input().split()]
	k = int(input())
	p.sort()
	p = p[::-1]
	l = 0
	r = n
	if y > x:
		(x, y) = (y, x)
		(a, b) = (b, a)
	if f(r) < k:
		print(-1)
	else:
		while r - l > 1:
			m = (l + r) // 2
			if f(m) < k:
				l = m
			else:
				r = m
		print(r)


from math import gcd
q = int(input())
for i in range(q):
	n = int(input())
	p = sorted(map(int, input().split()), key=int)[::-1]
	(x, a) = map(int, input().split())
	(y, b) = map(int, input().split())
	k = int(input())
	c = a * b // gcd(a, b)
	if y > x:
		(x, y) = (y, x)
		(a, b) = (b, a)

	def check(m):
		add = 0
		hc = m // c
		ha = m // a - hc
		hb = m // b - hc
		for j in range(hc):
			add += (x + y) * p[j] // 100
		for j in range(hc, hc + ha):
			add += x * p[j] // 100
		for j in range(hc + ha, hc + ha + hb):
			add += y * p[j] // 100
		return add
	(lo, hi) = (1, n)
	ans = -1
	while lo <= hi:
		mid = (lo + hi) // 2
		val = check(mid)
		if val >= k:
			ans = mid
			hi = mid - 1
		else:
			lo = mid + 1
	print(ans)


def nok(a, b):
	return a * b // gcd(a, b)

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def test(z):
	nonlocal x, a, y, b, p, k
	ans = 0
	xayb = z // nok(a, b)
	xa = z // a - xayb
	yb = z // b - xayb
	if x >= y:
		x1 = xa
		x2 = yb
		y1 = x
		y2 = y
	else:
		x1 = yb
		x2 = xa
		y1 = y
		y2 = x
	for i in range(xayb):
		ans += p[i] // 100 * (x + y)
	for i in range(xayb, xayb + x1):
		ans += p[i] // 100 * y1
	for i in range(xayb + x1, xayb + x1 + x2):
		ans += p[i] // 100 * y2
	return ans >= k
q = int(input())
for i in range(q):
	n = int(input())
	p = list(map(int, input().split()))
	p.sort(reverse=True)
	(x, a) = map(int, input().split())
	(y, b) = map(int, input().split())
	k = int(input())
	left = 0
	right = n
	if not test(right):
		print(-1)
	else:
		while right - left > 1:
			mid = (left + right) // 2
			if test(mid):
				right = mid
			else:
				left = mid
		print(right)


import math
global n, p, x, y, a, b, k

def check(m):
	(lst, res) = (0, 0)
	lcm = a * b // math.gcd(a, b)
	t1 = m // lcm
	for i in range(t1):
		if res >= k:
			return True
		if lst >= m:
			return False
		res += p[lst] // 100 * (x + y)
		lst += 1
	t2 = m // a - m // lcm
	for i in range(t2):
		if res >= k:
			return True
		if lst >= m:
			return False
		res += p[lst] // 100 * x
		lst += 1
	t3 = m // b - m // lcm
	for i in range(t3):
		if res >= k:
			return True
		if lst >= m:
			return False
		res += p[lst] // 100 * y
		lst += 1
	if res >= k:
		return True
for _ in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	(x, a) = map(int, input().split())
	(y, b) = map(int, input().split())
	k = int(input())
	p.sort(reverse=True)
	if x < y:
		(x, a, y, b) = (y, b, x, a)
	(l, r) = (0, n)
	if not check(n):
		print(-1)
		continue
	while r - l > 1:
		m = (r + l) // 2
		if not check(m):
			l = m
		else:
			r = m
			was = True
	print(r)


import math
R = lambda : [*map(int, input().split())]
f = lambda m: p[m // b] * y + (p[m // c] + p[m // b + m // a - m // c] - p[m // b]) * x
(q,) = R()
for _ in [0] * q:
	(r,) = R()
	l = [0, r]
	p = [0] + sorted(R())[::-1]
	for i in range(l[1]):
		p[i + 1] += p[i]
	((x, a), (y, b)) = sorted((R(), R()))
	c = a * b // math.gcd(a, b)
	(k,) = R()
	k *= 100
	while l[1] - l[0] > 1:
		m = sum(l) // 2
		l[f(m) >= k] = m
	print((l[1], -1)[f(l[1]) < k])


t = int(input())
for case_num in range(t):
	n = int(input())
	p = list(map(int, input().split(' ')))
	(x, a) = map(int, input().split(' '))
	(y, b) = map(int, input().split(' '))
	k = int(input())
	p.sort()
	p.reverse()
	sum = [0]
	for i in range(n):
		sum.append(sum[-1] + p[i])
	if x < y:
		(x, y) = (y, x)
		(a, b) = (b, a)
	nab = 0
	na = 0
	nb = 0
	ans = -1
	for i in range(1, n + 1):
		if i % a != 0 and i % b != 0:
			continue
		if i % a == 0 and i % b == 0:
			nab += 1
		if i % a == 0 and i % b != 0:
			na += 1
		if i % a != 0 and i % b == 0:
			nb += 1
		current = (sum[nab] * (x + y) + (sum[nab + na] - sum[nab]) * x + (sum[nab + na + nb] - sum[nab + na]) * y) // 100
		if current >= k:
			ans = i
			break
	print(ans)


def nod(a, b):
	while a * b != 0:
		if a > b:
			a %= b
		else:
			b %= a
	return a + b

def rec(m, x, a, y, b):
	nonlocal p
	(cx, cy, cxy) = (0, 0, 0)
	for i in range(1, m + 1):
		if i % a == 0 and i % b == 0:
			cxy += 1
		elif i % a == 0:
			cx += 1
		elif i % b == 0:
			cy += 1
	ans = 0
	for i in range(cxy):
		ans += p[i] * (x + y)
	for i in range(cx):
		ans += p[cxy + i] * x
	for i in range(cy):
		ans += p[cxy + cx + i] * y
	return ans
n = int(input())
for i in range(n):
	q = int(input())
	p = [int(j) for j in input().split()]
	p.sort(reverse=True)
	(x, a) = list(map(int, input().split()))
	(y, b) = list(map(int, input().split()))
	if y > x:
		(x, a, y, b) = (y, b, x, a)
	k = int(input())
	k = k * 100
	lf = 0
	rg = q + 1
	while rg - lf > 1:
		m = (rg + lf) // 2
		if rec(m, x, a, y, b) >= k:
			rg = m
		else:
			lf = m
	if rg > q:
		rg = -1
	print(rg)


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

def num():
	return int(input())
from itertools import repeat

def gcd(a, b):
	if a < b:
		(a, b) = (b, a)
	while b != 0:
		t = b
		b = a % b
		a = t
	return a

def lcm(a, b):
	return a * b // gcd(a, b)
q = num()
for _ in repeat(None, q):
	n = num()
	p = sorted(line(), reverse=True)
	(x, a) = line()
	(y, b) = line()
	if x > y:
		(x, a, y, b) = (y, b, x, a)
	k = num()
	u = lcm(a, b)

	def f(i):
		ums = i // u
		(ams, bms) = (i // a - ums, i // b - ums)
		return sum(p[:ums]) * (x + y) + sum(p[ums:ums + bms]) * y + sum(p[ums + bms:ums + bms + ams]) * x

	def cool(e):
		s = 1
		ans = -1
		while s <= e:
			m = (s + e) // 2
			d = f(m)
			if d < k * 100:
				s = m + 1
			else:
				ans = m
				e = m - 1
		return ans
	print(cool(n + 1))


from collections import deque
n = int(input())
for _ in range(n):
	m = int(input())
	tickets = list(map(int, input().split()))
	tickets.sort(reverse=True)
	(aperc, ajump) = map(int, input().split())
	(bperc, bjump) = map(int, input().split())
	q = int(input())
	if bperc > aperc:
		(bperc, aperc) = (aperc, bperc)
		(ajump, bjump) = (bjump, ajump)
	aperc = aperc / 100
	bperc = bperc / 100
	zet = False
	ans = -1
	sumo = 0
	da = deque()
	db = deque()
	dc = deque()
	tc = 0
	for i in range(m):
		z = i + 1
		if z % ajump == 0 and z % bjump == 0:
			if len(da) > 0:
				xx = da.pop()
				dc.appendleft(xx)
				if len(db) > 0:
					xxx = db.pop()
					da.appendleft(xxx)
					db.appendleft(tickets[tc])
					sumo = sumo + bperc * xx + (aperc - bperc) * xxx + bperc * tickets[tc]
				else:
					da.appendleft(tickets[tc])
					sumo = sumo + bperc * xx + aperc * tickets[tc]
			elif len(db) > 0:
				xx = db.pop()
				dc.appendleft(xx)
				db.appendleft(tickets[tc])
				sumo = sumo + aperc * xx + bperc * tickets[tc]
			else:
				dc.appendleft(tickets[tc])
				sumo = sumo + (aperc + bperc) * tickets[tc]
			tc += 1
		elif z % ajump == 0:
			if len(db) > 0:
				xx = db.pop()
				da.appendleft(xx)
				db.appendleft(tickets[tc])
				sumo = sumo + (aperc - bperc) * xx + bperc * tickets[tc]
			else:
				da.appendleft(tickets[tc])
				sumo = sumo + aperc * tickets[tc]
			tc += 1
		elif z % bjump == 0:
			db.appendleft(tickets[tc])
			sumo = sumo + bperc * tickets[tc]
			tc += 1
		else:
			pass
		if sumo >= q and (not zet):
			zet = True
			ans = i + 1
			break
	print(ans)


import sys
input = sys.stdin.readline

def calc(n):
	(cxy, cx, cy) = (0, 0, 0)
	for i in range(1, n + 1):
		if i % a == 0:
			if i % b == 0:
				cxy += 1
			else:
				cx += 1
		elif i % b == 0:
			cy += 1
	som = (sum(p[0:cxy]) * (x + y) + sum(p[cxy:cxy + cx]) * x + sum(p[cxy + cx:cxy + cx + cy]) * y) // 100
	if som >= k:
		return 1
	else:
		return 0
for _ in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	(x, a) = map(int, input().split())
	(y, b) = map(int, input().split())
	k = int(input())
	p.sort(reverse=True)
	if y > x:
		(x, y) = (y, x)
		(a, b) = (b, a)
	if calc(n) != 1:
		print(-1)
	else:
		high = n
		low = 1
		m = n
		while low < high:
			mid = (low + high) // 2
			if calc(mid) == 1:
				if mid < m:
					m = mid
				high = mid
			else:
				low = mid + 1
		print(m)


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import ceil, floor
from copy import *
from collections import deque, defaultdict
from collections import Counter as counter
from itertools import combinations
from itertools import permutations as permutate
from bisect import bisect_left as bl
from operator import *
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192
from sys import stderr

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 1000000007

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

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

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())

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def pow(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res
from functools import reduce

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

def gcd(a, b):
	if a == b:
		return a
	while b > 0:
		(a, b) = (b, a % b)
	return a

def prefix_sum(ar):
	return list(accumulate(ar))

def suffix_sum(ar):
	return list(accumulate(ar[::-1]))[::-1]

def N():
	return int(inp())
dx = [0, 0, 1, -1]
dy = [1, -1, 0, 0]

def YES():
	print('YES')

def NO():
	print('NO')

def Yes():
	print('Yes')

def No():
	print('No')
from collections import defaultdict

def numberOfSetBits(i):
	i = i - (i >> 1 & 1431655765)
	i = (i & 858993459) + (i >> 2 & 858993459)
	return ((i + (i >> 4) & 252645135) * 16843009 & 4294967295) >> 24

class MergeFind:

	def __init__(self, n):
		self.parent = list(range(n))
		self.size = [1] * n
		self.num_sets = n

	def find(self, a):
		to_update = []
		while a != self.parent[a]:
			to_update.append(a)
			a = self.parent[a]
		for b in to_update:
			self.parent[b] = a
		return self.parent[a]

	def merge(self, a, b):
		a = self.find(a)
		b = self.find(b)
		if a == b:
			return
		self.num_sets -= 1
		self.parent[a] = b
		self.size[b] += self.size[a]

	def set_size(self, a):
		return self.size[self.find(a)]

	def __len__(self):
		return self.num_sets

def lcm(a, b):
	return abs(a // gcd(a, b) * b)

def solve():
	n = N()
	p = lis()
	p.sort(reverse=True)
	(x, a) = sep()
	(y, b) = sep()
	if y > x:
		(x, y) = (y, x)
		(a, b) = (b, a)
	k = N()

	def isvalid(num):
		if num > n:
			return 1
		t = lcm(a, b)
		req12 = num // t
		req1 = num // a - req12
		req2 = num // b - req12
		s = 0
		for i in range(num):
			if i < req12:
				s += (x + y) * p[i]
				continue
			if i < req12 + req1:
				s += x * p[i]
				continue
			if i < req12 + req1 + req2:
				s += y * p[i]
			else:
				break
		if s // 100 >= k:
			return 1
		return 0

	def search():
		l = 0
		r = 10 ** 10
		for i in range(200):
			if isvalid(l):
				return l
			if l == r:
				return l
			m = (l + r) // 2
			if isvalid(m) and (not isvalid(m - 1)):
				return m
			if isvalid(m):
				r = m + 1
			else:
				l = m
		return m
	ans = search()
	if ans > n:
		print(-1)
	else:
		print(ans)
testcase(int(inp()))


from math import *
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	(z, x) = map(int, input().split())
	(t, y) = map(int, input().split())
	lcd = x * y // gcd(x, y)
	if z < t:
		(x, y, z, t) = (y, x, t, z)
	w1 = z + t
	k = int(input())
	a.sort(reverse=True)
	(l, r) = (-1, len(a) + 1)
	while r - l > 1:
		m = (l + r) // 2
		(w, ans) = (m // lcd, 0)
		for q in range(w):
			ans += a[q] // 100 * w1
		for q in range(w, m // x):
			ans += a[q] // 100 * z
		for q in range(m // x, m // x + m // y - w):
			ans += a[q] // 100 * t
		if ans >= k:
			r = m
		else:
			l = m
	if r == len(a) + 1:
		print(-1)
	else:
		print(r)


import os
import sys
from io import BytesIO, IOBase
from math import gcd

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

def check(p, x, a, y, b, k, mid):
	(z, i, su) = (lcm(a, b), 0, 0)
	while i < mid // z:
		su += p[i] * (x + y) // 100
		i += 1
	j = 0
	while j < mid // a - mid // z:
		su += p[i] * x // 100
		i += 1
		j += 1
	j = 0
	while j < mid // b - mid // z:
		su += p[i] * y // 100
		i += 1
		j += 1
	return su >= k

def solve():
	n = int(input())
	p = sorted(map(int, input().split()), reverse=True)
	(x, a) = map(int, input().split())
	(y, b) = map(int, input().split())
	if y > x:
		(x, a, y, b) = (y, b, x, a)
	k = int(input())
	(lo, hi, ans) = (1, n, -1)
	while lo <= hi:
		mid = (lo + hi) // 2
		if check(p, x, a, y, b, k, mid):
			ans = mid
			hi = mid - 1
		else:
			lo = mid + 1
	return ans

def main():
	for _ in range(int(input())):
		print(solve())
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


def Input():
	global A, n, x, a, y, b, k
	n = int(input())
	A = sorted([int(i) // 100 for i in input().split()], reverse=True)
	(x, a) = map(int, input().split())
	(y, b) = map(int, input().split())
	if x < y:
		(x, a, y, b) = (y, b, x, a)
	k = int(input())

def Ans(n):
	(Xa, Yb, XY) = (0, 0, 0)
	for i in range(1, n + 1):
		if not i % a:
			if not i % b:
				XY += 1
			else:
				Xa += 1
		elif not i % b:
			Yb += 1
	ans = sum(A[:XY]) * (x + y)
	ans += sum(A[XY:XY + Xa]) * x
	ans += sum(A[XY + Xa:XY + Xa + Yb]) * y
	return ans

def main():
	for i in range(int(input())):
		Input()
		L = 0
		R = n + 1
		while R - L > 1:
			m = (L + R) // 2
			if Ans(m) >= k:
				R = m
			else:
				L = m
		print(-1 if R > n else R)
main()


import sys
input = sys.stdin.readline

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def lcm(a, b):
	return a // gcd(a, b) * b

def judge(m):
	ab_cnt = m // L
	a_cnt = m // a - ab_cnt
	b_cnt = m // b - ab_cnt
	per = [x + y] * ab_cnt + [x] * a_cnt + [y] * b_cnt
	s = 0
	for i in range(len(per)):
		s += per[i] * p[i]
	return s >= 100 * k

def binary_search():
	(l, r) = (1, n)
	while l <= r:
		mid = (l + r) // 2
		if judge(mid):
			r = mid - 1
		else:
			l = mid + 1
	return l
q = int(input())
for _ in range(q):
	n = int(input())
	p = list(map(int, input().split()))
	p.sort(reverse=True)
	(x, a) = map(int, input().split())
	(y, b) = map(int, input().split())
	if x < y:
		(x, y) = (y, x)
		(a, b) = (b, a)
	L = lcm(a, b)
	k = int(input())
	ans = binary_search()
	if ans == n + 1:
		print(-1)
	else:
		print(ans)


def gcd(a, b):
	return a if b == 0 else gcd(b, a % b)

def nk(a, b):
	return a * b // gcd(a, b)

def check(arr, x, y, a, b, mid, k):
	GdCN = mid // nk(a, b)
	if x > y:
		MAP = x
		MIP = y
		MAD = a
		MID = b
	else:
		MAP = y
		MIP = x
		MAD = b
		MID = a
	GCN = mid // MAD - GdCN
	BCN = mid // MID - GdCN
	if sum(arr[:GdCN]) * (x + y) // 100 + sum(arr[GdCN:GdCN + GCN]) * MAP // 100 + sum(arr[GdCN + GCN:GdCN + GCN + BCN]) * MIP // 100 >= k:
		return True
	else:
		return False
n = int(input())
for i in range(n):
	input()
	arr = [int(x) for x in input().split()]
	(x, a) = [int(x) for x in input().split()]
	(y, b) = [int(x) for x in input().split()]
	k = int(input())
	arr = sorted(arr)[::-1]
	left = 0
	right = len(arr)
	while right - left > 1:
		mid = (right + left) // 2
		if check(arr, x, y, a, b, mid, k):
			right = mid
		else:
			left = mid
	if check(arr, x, y, a, b, left, k):
		print(left)
	elif check(arr, x, y, a, b, right, k):
		print(right)
	else:
		print(-1)


def gcd(a, b):
	if a > b:
		return gcd(b, a)
	if a == 0:
		return b
	return gcd(b % a, a)
q = int(input())
for i in range(q):
	n = int(input())
	lol = list(map(int, input().split()))
	lol.sort(reverse=True)
	(x, a) = map(int, input().split())
	(y, b) = map(int, input().split())
	if x < y:
		(x, y) = (y, x)
		(a, b) = (b, a)
	k = int(input())
	ans = 0
	(l, r) = (0, n)
	baaa = a * b // gcd(a, b)
	m = n
	kol = 0
	for i in range(m // baaa):
		ans += lol[i] * (x + y) // 100
	for j in range(m // baaa, m // a):
		ans += lol[j] * x // 100
		kol += 1
	for j in range(m // baaa + kol, m // b + kol):
		ans += lol[j] * y // 100
	if k > ans:
		print(-1)
	else:
		(l, r) = (0, n)
		while r - l > 1:
			kol = 0
			m = (l + r) // 2
			ans = 0
			for i in range(m // baaa):
				ans += lol[i] * (x + y) // 100
			for j in range(m // baaa, m // a):
				ans += lol[j] * x // 100
				kol += 1
			for p in range(m // baaa + kol, m // b + kol):
				ans += lol[p] * y // 100
			if k > ans:
				l = m
			else:
				r = m
		print(r)


from math import gcd
q = int(input())
for i in range(q):
	n = int(input())
	lst = sorted([int(j) for j in input().split()])[::-1]
	(x, a) = [int(j) for j in input().split()]
	(y, b) = [int(j) for j in input().split()]
	k = int(input())
	lcm = a * b // gcd(a, b)
	if y > x:
		(x, y) = (y, x)
		(a, b) = (b, a)

	def check(m):
		(count, hc) = (0, m // lcm)
		(ha, hb) = (m // a - hc, m // b - hc)
		for j in range(hc):
			count += (x + y) * lst[j] // 100
		for j in range(hc, hc + ha):
			count += x * lst[j] // 100
		for j in range(hc + ha, hc + ha + hb):
			count += y * lst[j] // 100
		return count
	(low, high, result) = (1, n, -1)
	while low <= high:
		middle = (low + high) // 2
		value = check(middle)
		if value >= k:
			(result, high) = (middle, middle - 1)
		else:
			low = middle + 1
	print(result)


def sell(p, x, a, y, b, m):
	from math import gcd
	i2 = m // a
	i1 = i2 // (b // gcd(a, b))
	return x * sum(p[:i2]) + y * (sum(p[:i1]) + sum(p[i2:m // b + i2 - i1]))

def main():
	for _ in range(int(input())):
		n = int(input())
		p = sorted((int(pi) // 100 for pi in input().split()), reverse=True)
		(x, a) = list(map(int, input().split()))
		(y, b) = list(map(int, input().split()))
		if x < y:
			(x, a, y, b) = (y, b, x, a)
		k = int(input())
		(l_, r) = (0, n + 1)
		while r - l_ > 1:
			m = (l_ + r) // 2
			if sell(p, x, a, y, b, m) >= k:
				r = m
			else:
				l_ = m
		print(-1 if r > n else r)
main()


from sys import stdin
input = stdin.readline
I = lambda : map(int, input().split())
p = []

def calc(n, a, b, x, y):
	X = n // a
	Y = n // b
	c = 0
	for i in range(1, n + 1):
		if i % a == 0 and i % b == 0:
			c += 1
	X -= c
	Y -= c
	ans = 0
	for i in range(n):
		if c:
			ans += p[i] * ((x + y) / 100)
			c -= 1
		elif X:
			ans += p[i] * (x / 100)
			X -= 1
		elif Y:
			ans += p[i] * (y / 100)
			Y -= 1
	return ans
for _ in ' ' * int(input()):
	(n, p) = (int(input()), [*I()])
	(x, a) = I()
	(y, b) = I()
	k = int(input())
	if x < y:
		(x, y, a, b) = (y, x, b, a)
	p.sort(reverse=True)
	(l, r) = (0, n)
	while r - l > 1:
		m = (l + r) // 2
		if calc(m, a, b, x, y) >= k:
			r = m
		else:
			l = m
	print(r if calc(r, a, b, x, y) >= k else -1)


import sys
input = sys.stdin.buffer.readline
import math

def bin_s(len, x, a, y, b, c, array):
	cx = len // a
	cy = len // b
	cxy = len // c
	cx -= cxy
	cy -= cxy
	total = (array[cxy] - array[0]) * (x + y) + (array[cxy + cx] - array[cxy]) * x + (array[cxy + cx + cy] - array[cxy + cx]) * y
	if total >= k:
		return 1
	return 0
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	for i in range(n):
		arr[i] //= 100
	arr.sort(reverse=True)
	array = [0 for i in range(n + 1)]
	for i in range(n):
		array[i + 1] = array[i] + arr[i]
	(x, a) = map(int, input().split())
	(y, b) = map(int, input().split())
	if x < y:
		(x, y) = (y, x)
		(a, b) = (b, a)
	k = int(input())
	z = x + y
	c = a * b // math.gcd(a, b)
	lft = 1
	rt = n
	while lft < rt:
		m = (lft + rt) // 2
		if bin_s(m, x, a, y, b, c, array):
			rt = m - 1
		else:
			lft = m + 1
	if bin_s(lft, x, a, y, b, c, array):
		print(lft)
	elif lft == n:
		print(-1)
	else:
		print(lft + 1)


from math import gcd

def lcm(a, b):
	return a * b // gcd(a, b)

def cheaker(mid):
	(p1, p2, p3) = (mid // lcm(a, b), mid // a - mid // lcm(a, b), mid // b - mid // lcm(a, b))
	c = 0
	xx = 0
	while c < n:
		if p1:
			xx += (x + y) * p[c]
			c += 1
			p1 -= 1
		elif p2:
			xx += x * p[c]
			c += 1
			p2 -= 1
		elif p3:
			xx += y * p[c]
			c += 1
			p3 -= 1
		else:
			c += 1
			break
		if xx >= k:
			return True
	return False
for _ in range(int(input())):
	n = int(input())
	p = [int(x) // 100 for x in input().split()]
	p = sorted(p, reverse=True)
	(x, a) = map(int, input().split())
	(y, b) = map(int, input().split())
	if y > x:
		(a, b) = (b, a)
		(x, y) = (y, x)
	k = int(input())
	do = 1
	up = n
	an = -1
	while up >= do:
		mid = (do + up) // 2
		if cheaker(mid):
			up = mid - 1
			an = mid
		else:
			do = mid + 1
	print(an)


import math

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def best(p, k, n):
	lcm = a * b // gcd(a, b)
	m = 0
	for i in range(k // lcm):
		m += p[i] * (x + y) // 100
	for i in range(k // a - k // lcm):
		m += p[i + k // lcm] * x // 100
	for i in range(k // b - k // lcm):
		m += p[i + k // a] * y // 100
	return m
t = int(input())
for nt in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	(x, a) = map(int, input().split())
	(y, b) = map(int, input().split())
	k = int(input())
	if x < y:
		(x, y) = (y, x)
		(a, b) = (b, a)
	p.sort(reverse=True)
	m = best(p, n, n)
	if m < k:
		print(-1)
	elif m == k:
		print(n)
	else:
		start = 0
		end = n + 1
		while end - start > 1:
			mid = (start + end) // 2
			m = best(p, mid, n)
			if m < k:
				start = mid
			else:
				end = mid
		print(end)


from math import gcd
for _ in range(int(input())):
	n = int(input())
	p2 = list(map(int, input().split()))
	p = sorted(p2, reverse=True)
	(x, a) = map(int, input().split())
	(y, b) = map(int, input().split())
	k = int(input())
	l = -1
	r = n + 1
	while r - l > 1:
		mid = (r + l) // 2
		m_cnt3 = mid // (a * b // gcd(a, b))
		m_cnt1 = mid // a - m_cnt3
		m_cnt2 = mid // b - m_cnt3
		res = sum(p[:m_cnt3]) // 100 * (x + y)
		if x > y:
			res += sum(p[m_cnt3:m_cnt1 + m_cnt3]) // 100 * x + sum(p[m_cnt1 + m_cnt3:m_cnt1 + m_cnt2 + m_cnt3]) // 100 * y
		else:
			res += sum(p[m_cnt3:m_cnt2 + m_cnt3]) // 100 * y + sum(p[m_cnt2 + m_cnt3:m_cnt1 + m_cnt2 + m_cnt3]) // 100 * x
		if res < k:
			l = mid
		else:
			r = mid
	if r == n + 1:
		print(-1)
	else:
		print(r)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for i in range(int(input())):
	f = 0
	n = int(input())
	p = list(map(int, input().split()))
	p.sort(reverse=True)
	p = [0] + p
	for j in range(1, n + 1):
		p[j] += p[j - 1]
	(xp, xv) = map(int, input().split())
	(yp, yv) = map(int, input().split())
	target = int(input())
	target = target * 100
	xy = 0
	x = 0
	y = 0
	su = 0
	if xv < yv:
		(xv, yv) = (yv, xv)
		(xp, yp) = (yp, xp)
	for k in range(1, n + 1):
		su = 0
		if k % xv == 0 and k % yv == 0:
			xy += 1
		elif k % xv == 0:
			x += 1
		elif k % yv == 0:
			y += 1
		su = max(su, p[xy] * (xp + yp) + p[xy + x] * xp - p[xy] * xp + p[xy + x + y] * yp - p[xy + x] * yp)
		su = max(su, p[xy] * (xp + yp) + p[xy + y] * yp - p[xy] * yp + p[xy + x + y] * xp - p[xy + y] * xp)
		if su >= target:
			print(k)
			f = 1
			break
	if f == 0:
		print(-1)


def gcd(x, y):
	if y:
		return gcd(y, x % y)
	return x
for _ in range(int(input())):
	n = int(input())
	a = [0] + sorted(map(int, input().split()))[::-1]
	for i in range(n):
		a[i + 1] += a[i]
	(p1, x1) = map(int, input().split())
	(p2, x2) = map(int, input().split())
	if p1 < p2:
		(p1, x1, p2, x2) = (p2, x2, p1, x1)
	g = gcd(x1, x2)
	xx = x1 // g * x2

	def f(x):
		c1 = x // x1
		c2 = x // x2
		c3 = x // xx
		ret = a[c3] * (p1 + p2)
		ret += (a[c1] - a[c3]) * p1
		ret += (a[c1 + c2 - c3] - a[c1]) * p2
		return ret // 100
	m = int(input())
	(lo, hi) = (0, n)
	while lo < hi:
		mid = (lo + hi) // 2
		if f(mid) < m:
			lo = mid + 1
		else:
			hi = mid
	print(-1 if f(lo) < m else lo)


def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
q = int(input())
for _ in range(q):
	n = int(input())
	prices = list(map(int, input().split()))
	(x, a) = map(int, input().split())
	(y, b) = map(int, input().split())
	k = int(input())
	if x < y:
		(x, y) = (y, x)
		(a, b) = (b, a)
	prices.sort(reverse=True)
	ab_lcm = a * b // gcd(a, b)
	ans_found = False
	m_variants = []
	l = 1
	r = n
	while l <= r:
		m = (l + r) // 2
		count_xy = m // ab_lcm
		count_x = m // a - count_xy
		count_y = m // b - count_xy
		ans = (x + y) * sum(prices[:count_xy])
		ans += x * sum(prices[count_xy:count_xy + count_x])
		ans += y * sum(prices[count_xy + count_x:count_xy + count_x + count_y])
		ans /= 100
		if ans >= k:
			ans_found = True
			m_variants.append(m)
			r = m - 1
		else:
			l = m + 1
	if ans_found:
		print(m_variants[-1])
	else:
		print(-1)


from math import *

def ok(v, x, a, y, b, k, m):
	gcdd = a * b // gcd(a, b)
	anss = [0 for j in range(m + 1)]
	idd = 0
	for i in range(1, m + 1):
		if i % gcdd == 0:
			anss[i] = v[idd] * (x + y) // 100
			idd += 1
	maxmass = a
	maxmastt = b
	mx = x
	mn = y
	if x > y:
		(maxmass, maxmastt, mx, mn) = (a, b, x, y)
	else:
		(maxmass, maxmastt, mx, mn) = (b, a, y, x)
	for i in range(1, m + 1):
		if i % maxmass == 0 and anss[i] == 0:
			anss[i] = v[idd] * mx // 100
			idd += 1
	for i in range(1, m + 1):
		if i % maxmastt == 0 and anss[i] == 0:
			anss[i] = v[idd] * mn // 100
			idd += 1
	summ = 0
	for i in range(1, m + 1):
		summ += anss[i]
	return summ >= k
for _ in ' ' * int(input()):
	n = int(input())
	v = [int(i) for i in input().split()]
	for i in range(10):
		v.append(0)
	(x, a) = [int(i) for i in input().split()]
	(y, b) = [int(i) for i in input().split()]
	k = int(input())
	v.sort(reverse=True)
	(hi, lo) = (n + 1, -1)
	midd = (hi + lo) // 2
	while hi - lo > 1:
		midd = (hi + lo) // 2
		if ok(v, x, a, y, b, k, midd):
			hi = midd
		else:
			lo = midd
	if ok(v, x, a, y, b, k, lo):
		print(lo)
	elif ok(v, x, a, y, b, k, hi):
		print(hi)
	else:
		print(-1)


from sys import stdin, setrecursionlimit
setrecursionlimit(10 ** 7)

def iin():
	return int(stdin.readline())

def lin():
	return list(map(int, stdin.readline().split()))

def calc(p, md, x, a, y, b):
	ch = [0, 0, 0]
	for i in range(md):
		ch1 = i + 1
		if ch1 % a == 0 and ch1 % b == 0:
			ch[0] += 1
		elif ch1 % a == 0:
			ch[1] += 1
		elif ch1 % b == 0:
			ch[2] += 1
	ans = 0
	sm = sum(ch)
	for i in range(sm):
		if i < ch[0]:
			ans += p[i] * (x + y)
		elif i < ch[1] + ch[0]:
			ans += p[i] * x
		else:
			ans += p[i] * y
	return ans // 100

def main():
	for _ in range(iin()):
		n = iin()
		p = lin()
		p.sort(reverse=True)
		(x, a) = lin()
		(y, b) = lin()
		if y > x:
			(y, x) = (x, y)
			(a, b) = (b, a)
		k = iin()
		(l, r) = (0, n + 1)
		while l < r:
			md = (l + r) // 2
			if calc(p, md, x, a, y, b) >= k:
				r = md
			else:
				l = md + 1
		if r > n:
			r = -1
		print(r)
main()


from sys import stdin, stdout
from math import gcd, sqrt
from collections import deque
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\n')
L = lambda : list(R())
P = lambda x: stdout.write(x)
hg = lambda x, y: (y + x - 1) // x * x
pw = lambda x: 1 if x == 1 else 1 + pw(x // 2)
chk = lambda x: chk(x // 2) if not x % 2 else True if x == 1 else False
N = 10 ** 10 + 7

def get_val(a):
	sm = 0
	for i in range(len(a)):
		sm += a[i] * (v[i] // 100)
	return sm
for _ in range(I()):
	n = I()
	v = sorted(R(), reverse=True)
	(x, a) = R()
	(y, b) = R()
	k = I()
	p = [0] * n
	for i in range(a - 1, n, a):
		p[i] += x
	for i in range(b - 1, n, b):
		p[i] += y
	l = 1
	r = n
	ans = -1
	while l <= r:
		m = (l + r) // 2
		if get_val(sorted(p[:m], reverse=True)) >= k:
			ans = m
			r = m - 1
		else:
			l = m + 1
	print(ans)


def fu(k):
	cxy = 0
	cx = 0
	cy = 0
	for i in range(k):
		if (i + 1) % a == 0 and (i + 1) % b == 0:
			cxy += 1
		elif (i + 1) % a == 0:
			cx += 1
		elif (i + 1) % b == 0:
			cy += 1
	s = sum(p[:cxy]) * (x + y) // 100
	s += sum(p[cxy:cxy + cx]) * x // 100
	s += sum(p[cxy + cx:cxy + cx + cy]) * y // 100
	return s
for _ in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	(x, a) = list(map(int, input().split()))
	(y, b) = list(map(int, input().split()))
	if x < y:
		(x, y) = (y, x)
		(a, b) = (b, a)
	k = int(input())
	p.sort(reverse=True)
	st = 0
	end = n
	e = 0
	while st <= end:
		mid = (st + end) // 2
		if fu(mid) < k:
			st = mid + 1
		else:
			end = mid - 1
	if st > n:
		print(-1)
	else:
		print(st)


import os
import sys
from io import BytesIO, IOBase
import math
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

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

def getint():
	return int(input())

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

def getint1():
	return list(map(lambda x: int(x) - 1, input().split()))

def count(len, x, a, y, b, lcm, p):
	cx = len // a
	cy = len // b
	cxy = len // lcm
	cx -= cxy
	cy -= cxy
	return sum([(x + y) * i for i in p[:cxy]] + [x * i for i in p[cxy:cxy + cx]] + [y * i for i in p[cxy + cx:cxy + cx + cy]])

def main():
	q = getint()
	for t in range(q):
		n = getint()
		p = sorted(getints(), reverse=True)
		p = [i // 100 for i in p]
		(x, a) = getints()
		(y, b) = getints()
		if x < y:
			(x, a, y, b) = (y, b, x, a)
		k = getint()
		lcm = a * b // math.gcd(a, b)
		(low, high) = (1, n + 1)
		f = 0
		while low < high:
			mid = (low + high) // 2
			if count(mid, x, a, y, b, lcm, p) >= k:
				high = mid
				f = 1
			else:
				low = mid + 1
		if f == 0:
			print(-1)
		else:
			print(low)
main()


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
import bisect
for j in range(int(input())):
	n = int(input())
	vals = list(map(int, input().split()))
	(x, a) = map(int, input().split())
	(y, b) = map(int, input().split())
	k = int(input())
	vals.sort()
	both = a * b // gcd(a, b)
	prefsum = [0]
	sum1 = 0
	for s in range(n):
		sum1 += vals[s]
		prefsum.append(sum1)
	tickets = 0
	px = 0
	py = 0
	ans = []
	while tickets < n:
		if (px + 1) * a == (py + 1) * b:
			px += 1
			py += 1
			tickets = px * a
		elif (px + 1) * a < (py + 1) * b:
			px += 1
			tickets = px * a
		else:
			py += 1
			tickets = py * b
		cxy = tickets // both
		cx = tickets // a
		cy = tickets // b
		money = 0
		if x <= y:
			l1 = [cxy, cy - cxy, cx - cxy]
			l2 = [(x + y) / 100, y / 100, x / 100]
			last = len(prefsum) - 1
			for s in range(3):
				money += (prefsum[last] - prefsum[last - l1[s]]) * l2[s]
				last = last - l1[s]
		else:
			l1 = [cxy, cx - cxy, cy - cxy]
			l2 = [(x + y) / 100, x / 100, y / 100]
			last = len(prefsum) - 1
			for s in range(3):
				money += (prefsum[last] - prefsum[last - l1[s]]) * l2[s]
				last -= l1[s]
		ans.append((money, tickets))
	ans.sort(key=lambda x: x[0])
	while ans[-1][1] > n:
		ans.pop()
	outy = [i[0] for i in ans]
	if outy[-1] >= k:
		ind = bisect.bisect_left(outy, k)
		print(ans[ind][1])
	else:
		print(-1)


def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def check(m):
	nonlocal n, arr, x, a, y, b, k
	arr2 = arr[:m]
	count_double = m // (a * b // gcd(a, b))
	maximals = sorted(arr, reverse=True)[:m // a + m // b - count_double]
	ans = 0
	for i in maximals[:count_double]:
		ans += (x + y) * i
	maximals = maximals[count_double:]
	count_a = m // a - count_double
	count_b = m // b - count_double
	for i in maximals[:count_a]:
		ans += x * i
	for i in maximals[count_a:]:
		ans += y * i
	return ans >= k
Q = int(input())
for q in range(Q):
	n = int(input())
	arr = list(map(int, input().split()))
	arr = [i // 100 for i in arr]
	(x, a) = tuple(map(int, input().split()))
	(y, b) = tuple(map(int, input().split()))
	k = int(input())
	if x < y:
		(x, a, y, b) = (y, b, x, a)
	left = 0
	right = n
	medium = 0
	while right - left > 1:
		medium = (left + right) // 2
		if check(medium):
			right = medium
		else:
			left = medium
	if check(left):
		print(left)
	elif check(medium):
		print(medium)
	elif check(right):
		print(right)
	else:
		print(-1)


import sys
from typing import List
q = int(sys.stdin.readline())
for _ in range(q):
	n = int(sys.stdin.readline())
	ps = list(map(int, sys.stdin.readline().split(' ')))
	(x, a) = tuple(map(int, sys.stdin.readline().split(' ')))
	(y, b) = tuple(map(int, sys.stdin.readline().split(' ')))
	k = int(sys.stdin.readline())
	L = 0
	R = n
	while L < R:
		M = (L + R) // 2
		numTickets = M + 1
		maxContrib = 0
		dotArr = [0] * n
		for (i, _) in enumerate(dotArr):
			if i >= numTickets:
				break
			if (i + 1) % a == 0:
				dotArr[i] += x
			if (i + 1) % b == 0:
				dotArr[i] += y
		maxContrib = sum(map(lambda t: t[0] * t[1] // 100, zip(sorted(dotArr), sorted(ps))))
		if maxContrib < k:
			L = M + 1
		else:
			R = M
	print(L + 1 if L + 1 < n + 1 else -1)


q = int(input())
for i in range(q):
	n = int(input())
	p = list(map(int, input().split()))
	p.sort(reverse=True)
	(x, a) = list(map(int, input().split()))
	(y, b) = list(map(int, input().split()))
	k = int(input())
	if x < y:
		(a, b, x, y) = (b, a, y, x)
	j = min(a, b)
	last_j = 0
	if j == a == b:
		A = 2 * a
		B = 2 * b
		np1 = 0
		np2 = 0
		np3 = 1
		new = 'p3'
	elif j == a:
		A = 2 * a
		B = b
		np1 = 1
		np2 = 0
		np3 = 0
		new = 'p1'
	else:
		A = a
		B = 2 * b
		np1 = 0
		np2 = 1
		np3 = 0
		new = 'p2'
	s = 0
	while j <= n and s < k:
		if new == 'p2':
			s += p[np1 + np2 + np3 - 1] / 100 * y
		elif new == 'p1':
			s += p[np3 + np1 - 1] / 100 * x
			if np2 > 0:
				s += p[np1 + np2 + np3 - 1] / 100 * y - p[np3 + np1 - 1] / 100 * y
		else:
			s += p[np3 - 1] / 100 * (y + x)
			if np1 > 0:
				s += p[np3 + np1 - 1] / 100 * x - p[np3 - 1] / 100 * x
			if np2 > 0:
				s += p[np1 + np3 + np2 - 1] / 100 * y - p[np1 + np3 - 1] / 100 * y
		last_j = j
		j = min(A, B)
		if j == A == B:
			A += a
			B += b
			np3 += 1
			new = 'p3'
		elif j == A:
			A += a
			np1 += 1
			new = 'p1'
		else:
			B += b
			np2 += 1
			new = 'p2'
	if s >= k:
		print(last_j)
	else:
		print(-1)


def gcd(a, b):
	if a * b == 0:
		return a + b
	return gcd(b, a % b)

def f():
	n = int(input())
	p = list(map(lambda x: int(x) // 100, input().split()))
	(x, a) = map(int, input().split())
	(y, b) = map(int, input().split())
	k = int(input())
	p.sort(reverse=True)
	ps = [0]
	for i in range(0, n):
		ps.append(ps[-1] + p[i])
	i = 0
	j = n
	if x < y:
		(x, y, a, b) = (y, x, b, a)
	m = n
	ab = a * b // gcd(a, b)
	colab = m // ab
	cola = m // a - colab
	colb = m // b - colab
	res = ps[colab] * (x + y) + (ps[colab + cola] - ps[colab]) * x + (ps[colab + cola + colb] - ps[cola + colab]) * y
	if res < k:
		return -1
	while j - i > 1:
		m = (i + j) // 2
		colab = m // ab
		cola = m // a - colab
		colb = m // b - colab
		res = ps[colab] * (x + y) + (ps[colab + cola] - ps[colab]) * x + (ps[colab + cola + colb] - ps[cola + colab]) * y
		if res >= k:
			j = m
		else:
			i = m
	return j
for i in range(int(input())):
	print(f())


q = int(input())

def check(l):
	return sum((i * j // 100 for (i, j) in zip(prices[-l:], sorted(p[:l])))) >= k
for i in range(q):
	n = int(input())
	prices = sorted(map(int, input().split()))
	(x, a) = list(map(int, input().split()))
	(y, b) = list(map(int, input().split()))
	k = int(input())
	p = [0] * n
	for j in range(n):
		c = 0
		if (j + 1) % a == 0:
			c += x
		if (j + 1) % b == 0:
			c += y
		p[j] = c
	if not check(n):
		print(-1)
	else:
		left = -1
		right = n
		while right - left > 1:
			middle = (right + left) // 2
			if check(middle):
				right = middle
			else:
				left = middle
		print(right)


from math import *

def cnt(valXY, valX, valY):
	global x, y
	return valXY * (x + y) + valX * x + valY * y

def checker(cntXY, cntX, cntY):
	global l
	v1 = l[cntXY - 1] if cntXY > 0 else 0
	v2 = l[cntXY + cntX - 1] - v1 if cntXY + cntX > 0 else 0
	v3 = l[cntXY + cntX + cntY - 1] - v2 - v1
	return cnt(v1, v2, v3)
for _ in range(int(input())):
	n = int(input())
	l = sorted(map(lambda i: int(i) // 100, input().split()), reverse=True)
	(x, a) = map(int, input().split())
	(y, b) = map(int, input().split())
	k = int(input())
	if y > x:
		(x, a, y, b) = (y, b, x, a)
	lcm = a * b // gcd(a, b)
	s = 0
	(cntXY, cntX, cntY, ticket) = (0, 0, 0, -1)
	for i in range(1, n):
		l[i] += l[i - 1]
	for i in range(1, n + 1):
		if i % lcm == 0:
			cntXY += 1
			s = checker(cntXY, cntX, cntY)
		elif i % a == 0:
			cntX += 1
			s = checker(cntXY, cntX, cntY)
		elif i % b == 0:
			cntY += 1
			s = checker(cntXY, cntX, cntY)
		if s >= k:
			ticket = i
			break
	print(ticket)


import math

def f(price, n, a, b, common, x, y, k):
	maxm = 0
	if x > y:
		for i in range(n // a):
			maxm += price[i] * x // 100
		for i in range(n // common):
			maxm += price[i] * y // 100
		for i in range(n // a, n // a + n // b - n // common):
			maxm += price[i] * y // 100
	else:
		for i in range(n // b):
			maxm += price[i] * y // 100
		for i in range(n // common):
			maxm += price[i] * x // 100
		for i in range(n // b, n // b + n // a - n // common):
			maxm += price[i] * x // 100
	if maxm >= k:
		return True
	else:
		return False
q = int(input())
for queries in range(q):
	n = int(input())
	price = list(map(int, input().split()))
	price.sort()
	price.reverse()
	(x, a) = map(int, input().split())
	(y, b) = map(int, input().split())
	k = int(input())
	common = a * b // math.gcd(a, b)
	if not f(price, n, a, b, common, x, y, k):
		print(-1)
	else:
		l = 0
		r = n
		while l < r:
			mid = (l + r) // 2
			if f(price, mid, a, b, common, x, y, k):
				r = mid
			else:
				l = mid + 1
		else:
			print(l)


from math import gcd
q = int(input())
for i in range(q):
	n = int(input())
	p = [10 ** 100] + [int(x) for x in input().split()]
	(x, a) = [int(x) for x in input().split()]
	(y, b) = [int(x) for x in input().split()]
	k = int(input())
	p.sort(reverse=True)
	flag = False
	l = 0
	r = n
	if x < y:
		(x, y) = (y, x)
		(a, b) = (b, a)
	z = a * b // gcd(a, b)
	while r - l > 1:
		mid = (l + r) // 2
		pointer = 1
		counter = 0
		for j in range(z, mid + 1, z):
			counter += p[pointer] * (x + y) // 100
			pointer += 1
		for j in range(a, mid + 1, a):
			if j % z != 0:
				counter += p[pointer] * x // 100
				pointer += 1
		for j in range(b, mid + 1, b):
			if j % z != 0:
				counter += p[pointer] * y // 100
				pointer += 1
		if counter >= k:
			flag = True
			r = mid
		else:
			l = mid
	mid = r
	pointer = 1
	counter = 0
	for j in range(z, mid + 1, z):
		counter += p[pointer] * (x + y) // 100
		pointer += 1
	for j in range(a, mid + 1, a):
		if j % z != 0:
			counter += p[pointer] * x // 100
			pointer += 1
	for j in range(b, mid + 1, b):
		if j % z != 0:
			counter += p[pointer] * y // 100
			pointer += 1
	if counter >= k:
		print(r)
	else:
		print(-1)


import math
t = int(input())

def check(mid):
	nonlocal n, p, x, a, y, b, k
	result = 0
	best = mid // (a * b // math.gcd(a, b))
	best_a = mid // a
	best_b = mid // b
	kolvo = 0
	for i in range(best):
		if kolvo == mid:
			break
		result += p[n - i - 1] // 100 * (x + y)
		kolvo += 1
	if x > y:
		for i in range(best_a - best):
			if kolvo == mid:
				break
			result += p[n - i - best - 1] // 100 * x
			kolvo += 1
		for i in range(best_b - best):
			if kolvo == mid:
				break
			result += p[n - i - (best_a - best) - best - 1] // 100 * y
			kolvo += 1
	else:
		for i in range(best_b - best):
			if kolvo == mid:
				break
			result += p[n - i - best - 1] // 100 * y
			kolvo += 1
		for i in range(best_a - best):
			if kolvo == mid:
				break
			result += p[n - i - (best_b - best) - best - 1] // 100 * x
			kolvo += 1
	if result >= k:
		return True
	return False
	if result >= k:
		return True
	return False
for i in range(t):
	n = int(input())
	p = [int(i) for i in input().split()]
	(x, a) = list(map(int, input().split()))
	(y, b) = list(map(int, input().split()))
	k = int(input())
	p.sort()
	left = 0
	right = n
	while right - left > 1:
		middle = (left + right) // 2
		if check(middle):
			right = middle
		else:
			left = middle
	if check(left):
		print(left)
	elif check(right):
		print(right)
	else:
		print(-1)


import sys
from operator import itemgetter

def main():
	input_list = get_input()
	for line in range(len(input_list[1:])):
		if line % 5 == 1:
			p_list = [int(x) for x in input_list[line + 1].split(' ')]
		elif line % 5 == 2:
			xa = [int(x) for x in input_list[line + 1].split(' ')]
		elif line % 5 == 3:
			yb = [int(x) for x in input_list[line + 1].split(' ')]
		elif line % 5 == 4:
			k = int(input_list[line + 1])
			print(solve(p_list, xa[0], yb[0], xa[1], yb[1], k))

def get_input():
	input_list = []
	for line in sys.stdin:
		input_list.append(line.rstrip('\n'))
	return input_list

def solve(p_list, x, y, a, b, k):
	return binary_search(p_list, x, y, a, b, 1, len(p_list), k)

def cont_max(p_list, x, y, a, b, i):
	big = max([x, a], [y, b], key=itemgetter(0))
	if big == [x, a]:
		small = [y, b]
	else:
		small = [x, a]
	(ab_count, a_count, b_count) = (0, 0, 0)
	p_list = sorted(p_list, reverse=True)[:i]
	for num in range(1, i + 1):
		if num % big[1] == 0 and num % small[1] == 0:
			ab_count += 1
		elif num % big[1] == 0 and num % small[1] != 0:
			a_count += 1
		elif num % big[1] != 0 and num % small[1] == 0:
			b_count += 1
	ab_cont = sum(p_list[:ab_count]) * ((big[0] + small[0]) / 100)
	a_cont = sum(p_list[ab_count:ab_count + a_count]) * (big[0] / 100)
	b_cont = sum(p_list[ab_count + a_count:ab_count + a_count + b_count]) * (small[0] / 100)
	return int(ab_cont + a_cont + b_cont)

def binary_search(p_list, x, y, a, b, lower, upper, value):
	if lower > upper:
		if lower > len(p_list):
			return -1
		else:
			return lower
	mid = lower + (upper - lower) // 2
	if cont_max(p_list, x, y, a, b, mid) >= value:
		return binary_search(p_list, x, y, a, b, lower, mid - 1, value)
	else:
		return binary_search(p_list, x, y, a, b, mid + 1, upper, value)
main()


for t in range(int(input())):
	n = int(input())
	l = [int(j) for j in input().split()]
	(x, a) = [int(j) for j in input().split()]
	(y, b) = [int(j) for j in input().split()]
	k = int(input())
	lf = 0
	ls = [0.0 for i in range(n)]
	for i in range(n):
		if (i + 1) % a == 0:
			ls[i] += x / 100
			ls[i] = min(ls[i], 1)
		if (i + 1) % b == 0:
			ls[i] += y / 100
			ls[i] = min(ls[i], 1)
	l.sort(reverse=True)
	rt = n - 1
	ans = None

	def fun(ind):
		tmp = []
		tmp2 = l[:ind + 1]
		for i in range(ind + 1):
			tmp.append(ls[i])
		tmp.sort(reverse=True)
		tans = 0
		for i in range(len(tmp)):
			tans += tmp[i] * tmp2[i]
		if tans >= k:
			return True
		return False
	while lf <= rt:
		m = lf + (rt - lf + 1) // 2
		if fun(m):
			ans = m
			rt = m - 1
		else:
			lf = m + 1
	if ans == None:
		print(-1)
	else:
		print(ans + 1)


tc = int(input())
while tc != 0:
	tc -= 1
	n = int(input())
	ar = list(map(int, input().split()))
	(x, a) = map(int, input().split())
	(y, b) = map(int, input().split())
	k = int(input())
	x /= 100
	y /= 100
	ar.sort(reverse=True)

	def lcm(p, q):
		from math import gcd
		return p * q // gcd(p, q)

	def fun(o):
		nab = o // lcm(a, b)
		na = o // a - nab
		nb = o // b - nab
		da = x
		db = y
		dab = x + y
		t = [(dab, nab, x + y), (da, na, x), (db, nb, y)]
		t.sort(key=lambda x: x[0], reverse=True)
		i = 0
		ans = 0
		while i < t[0][1]:
			ans += t[0][2] * ar[i]
			i += 1
		while i < t[0][1] + t[1][1]:
			ans += t[1][2] * ar[i]
			i += 1
		while i < t[0][1] + t[1][1] + t[2][1]:
			ans += t[2][2] * ar[i]
			i += 1
		return ans >= k
	l = 0
	h = n + 1
	while l + 1 < h:
		mid = l + h >> 1
		if fun(mid):
			h = mid
		else:
			l = mid
	if h > n:
		print('-1')
		continue
	print(h)


from sys import stdin

def fun(p, x, a, y, b, k, l, xy_n, x_n, y_n):
	(s, i) = (0, n)
	while xy_n and i:
		s += p[i - 1] * (x + y) // 100
		xy_n -= 1
		i -= 1
	while x_n and i:
		s += p[i - 1] * x // 100
		x_n -= 1
		i -= 1
	while y_n and i:
		s += p[i - 1] * y // 100
		y_n -= 1
		i -= 1
	return s

def solve(n, p, x, a, y, b, k):
	(xy_n, x_n, y_n) = ([0], [0], [0])
	for i in range(1, n + 1):
		xy_n.append(xy_n[i - 1] + int(i % a == 0 and i % b == 0))
		x_n.append(x_n[i - 1] + int(i % a == 0 and i % b != 0))
		y_n.append(y_n[i - 1] + int(i % a != 0 and i % b == 0))

	def f(l, xy_n, x_n, y_n):
		return fun(p, x, a, y, b, k, l, xy_n, x_n, y_n)
	(l, r) = (0, n + 1)
	while r - l > 1:
		mid = (l + r) // 2
		if f(mid, xy_n[mid], x_n[mid], y_n[mid]) >= k:
			r = mid
		else:
			l = mid
	if r > len(p):
		print(-1)
	else:
		print(r)
q = int(stdin.readline())
for i in range(q):
	n = int(stdin.readline())
	p = list(map(int, stdin.readline().split(' ')))
	p.sort()
	(x, a) = map(int, stdin.readline().split(' '))
	(y, b) = map(int, stdin.readline().split(' '))
	if y > x:
		(x, y) = (y, x)
		(a, b) = (b, a)
	k = int(stdin.readline())
	solve(n, p, x, a, y, b, k)


from math import gcd

def lcm(a, b):
	return a * b // gcd(a, b)
for _ in range(int(input())):
	n = int(input())
	P = list(map(int, input().split()))
	(x, a) = map(int, input().split())
	(y, b) = map(int, input().split())
	k = int(input())
	P.sort(reverse=True)
	l = 0
	r = n + 1
	while r - l > 1:
		m = (l + r) // 2
		g1 = m // lcm(a, b)
		g2 = m // a - g1
		g3 = m // b - g1
		cnt = 0
		for i in range(g1):
			cnt += (x + y) * P[i] // 100
		if x > y:
			for i in range(g1, g1 + g2):
				cnt += x * P[i] // 100
			for i in range(g1 + g2, g1 + g2 + g3):
				cnt += y * P[i] // 100
		else:
			for i in range(g1, g1 + g3):
				cnt += y * P[i] // 100
			for i in range(g1 + g3, g1 + g2 + g3):
				cnt += x * P[i] // 100
		if cnt >= k:
			r = m
		else:
			l = m
	if l == n:
		print(-1)
	else:
		print(l + 1)


def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def lcm(a, b):
	return a * b // gcd(a, b)
q = int(input())
while q > 0:
	n = int(input())
	p = sorted(list(map(int, input().split())), reverse=True)
	(x, a) = map(int, input().split())
	(y, b) = map(int, input().split())
	nsum = int(input())
	(maxper, maxint, minper, minint) = (0, 0, 0, 0)
	if x < y:
		(maxper, minper, maxint, minint) = (y, x, b, a)
	else:
		(maxper, minper, maxint, minint) = (x, y, a, b)
	(left, right, middle) = (0, n + 1, 0)
	while right - left > 1:
		middle = (left + right) // 2
		total = 0
		tlcm = lcm(a, b)
		tlcmk = middle // tlcm
		(tak, tbk) = (middle // maxint - tlcmk, middle // minint - tlcmk)
		cur = 0
		while cur < tlcmk:
			total += p[cur] // 100 * (x + y)
			cur += 1
		while cur < tlcmk + tak:
			total += p[cur] // 100 * maxper
			cur += 1
		while cur < tlcmk + tak + tbk:
			total += p[cur] // 100 * minper
			cur += 1
		if total >= nsum:
			right = middle
		else:
			left = middle
	if right == n + 1:
		print(-1)
	else:
		print(right)
	q -= 1


def cout(n):
	(cxy, cx, cy, s) = (0, 0, 0, 0)
	for i in range(1, n + 1):
		if not i % a:
			if not i % b:
				cxy += 1
			else:
				cx += 1
		elif not i % b:
			cy += 1
	return (sum(p[:cxy]) * (x + y) + sum(p[cxy:cxy + cx]) * x + sum(p[cxy + cx:cxy + cx + cy]) * y) // 100
for q in range(int(input())):
	n = int(input())
	p = sorted(list(map(int, input().split())), reverse=True)
	(x, a) = map(int, input().split())
	(y, b) = map(int, input().split())
	k = int(input())
	if y > x:
		(x, a, y, b) = (y, b, x, a)
	if cout(n) < k:
		print(-1)
	else:
		(low, high) = (1, n)
		while low < high:
			mid = (low + high) // 2
			if cout(mid) >= k:
				high = mid
			else:
				low = mid + 1
		print(low)


from math import gcd

def check(m, a, b, prices, k, x, y):
	acdc = m // a
	bcdc = m // b
	abcdc = m // (a * b // gcd(a, b))
	calc = 0
	while acdc or bcdc:
		new = prices.pop()
		if abcdc:
			calc += new * (x + y) // 100
			abcdc -= 1
			acdc -= 1
			bcdc -= 1
		elif acdc:
			calc += new * x // 100
			acdc -= 1
		else:
			calc += new * y // 100
			bcdc -= 1
	if calc < k:
		return 0
	return 1
n = int(input())
for i in range(n):
	p = int(input())
	prices = list(map(int, input().split()))
	(x, a) = map(int, input().split())
	(y, b) = map(int, input().split())
	prices.sort()
	k = int(input())
	L = 0
	R = p
	if y > x:
		(x, a, y, b) = (y, b, x, a)
	while R - L > 1:
		m = (R + L) // 2
		if check(m, a, b, prices.copy(), k, x, y):
			R = m
		else:
			L = m
	print(R if check(R, a, b, prices.copy(), k, x, y) else -1)


q = int(input())

def chek(l):
	s = 0
	for (i, j) in zip(sorted(procent[:l]), p[-l:]):
		s += i * j
	return s >= k
for i in range(q):
	n = int(input())
	p = sorted(list(map(int, input().split())))
	(x, a) = map(int, input().split())
	(y, b) = map(int, input().split())
	k = int(input())
	procent = [0] * n
	for i in range(n):
		if (i + 1) % a == 0:
			procent[i] += x / 100
		if (i + 1) % b == 0:
			procent[i] += y / 100
	if not chek(n):
		print(-1)
		continue
	right = n
	left = -1
	while right - left > 1:
		mid = (right + left) // 2
		if chek(mid):
			right = mid
		else:
			left = mid
	print(right)


from sys import stdin
from math import gcd
input = stdin.readline

def lcm(s, t):
	return s * t // gcd(s, t)

def check_contribution(m, p, x, a, y, b):
	p = p[:m]
	cnt_ab = m // lcm(a, b)
	cnt_a = m // a - cnt_ab
	cnt_b = m // b - cnt_ab
	tmp = 0
	for i in range(cnt_ab):
		tmp += p[i] * (x + y) // 100
	if x >= y:
		for i in range(cnt_ab, cnt_ab + cnt_a):
			tmp += p[i] * x // 100
		for i in range(cnt_ab + cnt_a, cnt_ab + cnt_a + cnt_b):
			tmp += p[i] * y // 100
	else:
		for i in range(cnt_ab, cnt_ab + cnt_b):
			tmp += p[i] * y // 100
		for i in range(cnt_ab + cnt_b, cnt_ab + cnt_a + cnt_b):
			tmp += p[i] * x // 100
	return tmp
q = int(input())
for _ in range(q):
	n = int(input())
	p = list(map(int, input().split()))
	p.sort(reverse=True)
	(x, a) = map(int, input().split())
	(y, b) = map(int, input().split())
	k = int(input())
	if check_contribution(n, p, x, a, y, b) < k:
		print(-1)
		continue
	ng = 0
	ok = n
	while ok - ng > 1:
		mid = (ok + ng) // 2
		if check_contribution(mid, p, x, a, y, b) >= k:
			ok = mid
		else:
			ng = mid
	print(ok)


from math import gcd

def check(m):
	global p, k, x, a, y, b
	ans = 0
	kx = m // a
	ky = m // b
	kxy = m // (a * b // gcd(a, b))
	kx -= kxy
	ky -= kxy
	for i in range(kxy):
		ans += p[i] * (x + y) // 100
	if x >= y:
		for i in range(kxy, kxy + kx):
			ans += p[i] * x // 100
		for i in range(kxy + kx, kxy + kx + ky):
			ans += p[i] * y // 100
	else:
		for i in range(kxy, kxy + ky):
			ans += p[i] * y // 100
		for i in range(kxy + ky, kxy + kx + ky):
			ans += p[i] * x // 100
	return ans
p = []
for i in range(int(input())):
	n = int(input())
	p = sorted(map(int, input().split()), reverse=True)
	(x, a) = map(int, input().split())
	(y, b) = map(int, input().split())
	k = int(input())
	l = 0
	r = n
	if check(n) < k:
		print(-1)
		continue
	else:
		while r - l > 1:
			m = (r + l) // 2
			if check(m) >= k:
				r = m
			else:
				l = m
		print(r)


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

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

def main():

	def calcOptimalValue(l):
		lcmCnts = l // lcmm
		aCnts = l // a - lcmCnts
		bCnts = l // b - lcmCnts
		lcmContributions = sum(p[:lcmCnts]) * (x + y)
		i = lcmCnts
		aContributions = 0
		for _ in range(aCnts):
			aContributions += p[i] * x
			i += 1
		bContributions = 0
		for _ in range(bCnts):
			bContributions += p[i] * y
			i += 1
		return lcmContributions + aContributions + bContributions
	q = int(input())
	allans = []
	for _ in range(q):
		n = int(input())
		p = readIntArr()
		p.sort(reverse=True)
		(x, a) = readIntArr()
		(y, b) = readIntArr()
		if x < y:
			temp = a
			a = b
			b = temp
			temp = x
			x = y
			y = temp
		lcmm = lcm(a, b)
		k = int(input())
		k *= 100
		if calcOptimalValue(n) < k:
			allans.append(-1)
		else:
			l = 0
			bb = n
			while bb > 0:
				while l + bb <= n and calcOptimalValue(l + bb) < k:
					l += bb
				bb //= 2
			l += 1
			allans.append(l)
	multiLineArrayPrint(allans)
	return
import sys
input = sys.stdin.buffer.readline

def oneLineArrayPrint(arr):
	print(' '.join([str(x) for x in arr]))

def multiLineArrayPrint(arr):
	print('\n'.join([str(x) for x in arr]))

def multiLineArrayOfArraysPrint(arr):
	print('\n'.join([' '.join([str(x) for x in y]) for y in arr]))

def readIntArr():
	return [int(x) for x in input().split()]

def makeArr(defaultValFactory, dimensionArr):
	dv = defaultValFactory
	da = dimensionArr
	if len(da) == 1:
		return [dv() for _ in range(da[0])]
	else:
		return [makeArr(dv, da[1:]) for _ in range(da[0])]

def queryInteractive(i, j):
	print('? {} {}'.format(i, j))
	sys.stdout.flush()
	return int(input())

def answerInteractive(ans):
	print('! {}'.format(' '.join([str(x) for x in ans])))
	sys.stdout.flush()
inf = float('inf')
MOD = 10 ** 9 + 7
for _abc in range(1):
	main()


def calc(arr, ll, a, b, x, y):
	rXY = 0
	rX = 0
	rY = 0
	result = 0
	for i in range(1, ll + 1):
		if i % a == 0 and i % b == 0:
			rXY += 1
		elif i % a == 0:
			rX += 1
		elif i % b == 0:
			rY += 1
	for i in range(rXY):
		result += arr[i] * ((x + y) / 100)
	for i in range(rX):
		result += arr[rXY + i] * (x / 100)
	for i in range(rY):
		result += arr[rXY + rX + i] * (y / 100)
	return result
q = int(input())
for _ in range(q):
	n = int(input())
	arr = list(map(int, input().split()))
	(x, a) = list(map(int, input().split()))
	(y, b) = list(map(int, input().split()))
	k = int(input())
	if x < y:
		(x, y) = (y, x)
		(a, b) = (b, a)
	arr.sort(reverse=True)
	left = 0
	right = n + 1
	while right - left > 1:
		mid = (right + left) // 2
		if calc(arr, mid, a, b, x, y) >= k:
			right = mid
		else:
			left = mid
	print(right if right <= n else -1)


n = int(input())

def ans(x, y, a, b, k):
	if ch(x, y, a, b, len(v)) < k:
		return -1
	(l, r) = (-1, len(v))
	while l + 1 != r:
		m = (l + r) // 2
		if ch(x, y, a, b, m) >= k:
			r = m
		else:
			l = m
	return r

def nok(a, b):
	(s, d) = (a, b)
	while b:
		(a, b) = (b, a % b)
	return s * d // a

def ch(x, y, a, b, m):
	ab = m // nok(a, b)
	a = m // a - ab
	b = m // b - ab
	if x > y:
		s = sum(v[0:ab]) * (x + y) + sum(v[ab:ab + a]) * x + sum(v[ab + a:ab + a + b]) * y
	else:
		s = sum(v[0:ab]) * (x + y) + sum(v[ab:ab + b]) * y + sum(v[ab + b:ab + a + b]) * x
	return s
for _ in range(n):
	input()
	v = sorted(list([int(x) // 100 for x in input().split()]), key=lambda x: -x)
	(x, a) = [int(x) for x in input().split()]
	(y, b) = [int(x) for x in input().split()]
	k = int(input())
	print(ans(x, y, a, b, k))


import math

def calc(tick, x, a, y, b, le):
	xyE = le // math.floor(a * b / math.gcd(a, b))
	xE = le // a - xyE
	yE = le // b - xyE
	s = 0
	ind = 0
	for i in range(int(xyE)):
		s += tick[ind] * (x + y)
		ind += 1
	for i in range(int(xE)):
		s += tick[ind] * x
		ind += 1
	for i in range(int(yE)):
		s += tick[ind] * y
		ind += 1
	return s
q = int(input())
rA = []
for z in range(q):
	n = int(input())
	tickets = [int(i) for i in input().split()]
	(x, a) = [int(i) for i in input().split()]
	(y, b) = [int(i) for i in input().split()]
	k = int(input())
	x /= 100.0
	y /= 100.0
	if y > x:
		t1 = x
		t2 = a
		x = y
		a = b
		y = t1
		b = t2
	tickets.sort()
	tickets.reverse()
	lf = 0
	rg = n + 1
	while rg - lf > 1:
		mid = (lf + rg) // 2
		if calc(tickets, x, a, y, b, mid) >= k:
			rg = mid
		else:
			lf = mid
	if rg > n:
		rg = -1
	rA.append(rg)
for el in rA:
	print(el)


def check(p, a, b, x, y, k, n):
	nab = n // (a * b // gcd(a, b))
	na = n // a - nab
	nb = n // b - nab
	h = 0
	for i in range(nab):
		h += p[i] * (x + y) // 100
		if h >= k:
			break
	if h >= k:
		return True
	if x > y:
		(x, y) = (y, x)
		(na, nb) = (nb, na)
	for i in range(nab, nab + nb):
		h += p[i] * y // 100
		if h >= k:
			break
	if h >= k:
		return True
	for i in range(nab + nb, nab + nb + na):
		h += p[i] * x // 100
		if h >= k:
			break
	if h >= k:
		return True
	else:
		return False

def gcd(a, b):
	if a > b:
		(a, b) = (b, a)
	while a != 0:
		(a, b) = (b % a, a)
	return b
q = int(input())
for _ in range(q):
	n = int(input())
	p = [int(i) for i in input().split()]
	(x, a) = [int(i) for i in input().split()]
	(y, b) = [int(i) for i in input().split()]
	k = int(input())
	p.sort(reverse=True)
	l = 1
	r = len(p) + 1
	while l < r:
		m = (l + r) // 2
		if check(p, a, b, x, y, k, m):
			r = m
		else:
			l = m + 1
	if l < len(p) + 1:
		print(l)
	else:
		print(-1)


import sys
input = sys.stdin.readline
from math import *

def bs(p, k, a, b, x, y):
	c = 0
	sumi = 0
	d = a * b // gcd(a, b)
	z = d
	d = a * b // gcd(a, b)
	while z <= len(p):
		sumi += p[c] // 100 * (x + y)
		z += d
		c += 1
	z = a
	if x > y:
		while z <= len(p):
			if z % b != 0:
				sumi += p[c] // 100 * x
				c += 1
			z += a
		z = b
		while z <= len(p):
			if z % a != 0:
				sumi += p[c] // 100 * y
				c += 1
			z += b
	else:
		z = b
		while z <= len(p):
			if z % a != 0:
				sumi += p[c] // 100 * y
				c += 1
			z += b
		z = a
		while z <= len(p):
			if z % b != 0:
				sumi += p[c] // 100 * x
				c += 1
			z += a
	return sumi >= k
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	p = [int(x) for x in input().split()]
	(x, a) = map(int, input().split())
	(y, b) = map(int, input().split())
	k = int(input())
	p.sort(reverse=True)
	s = 0
	e = n
	ans = -9
	while s <= e:
		mid = (s + e) // 2
		if bs(p[:mid], k, a, b, x, y):
			ans = mid
			e = mid - 1
		else:
			s = mid + 1
	flag = 0
	if n == 1:
		if p[0] // 100 * (x + y) < k:
			flag = 1
		else:
			ans = 1
	elif ans == -9:
		flag = 1
	print(ans if flag == 0 else -1)


def gcd(a, b):
	while a % b != 0:
		t = b
		b = a % b
		a = t
	return b

def lcm(a, b):
	return a * b // gcd(a, b)
for _ in range(int(input())):
	n = int(input())
	tickets = list(map(int, input().split()))
	(x, a) = list(map(int, input().split()))
	(y, b) = list(map(int, input().split()))
	k = int(input())
	lcmab = lcm(a, b)
	if y < x:
		(x, y) = (y, x)
		(a, b) = (b, a)
	tickets.sort(reverse=True)
	pfsums = [0] * (n + 1)
	ans = -1
	for i in range(1, n + 1):
		pfsums[i] = pfsums[i - 1] + tickets[i - 1]
		streak = i // lcmab
		xprof = i // a - streak
		yprof = i // b - streak
		mylen = i
		if mylen >= streak:
			got = pfsums[streak] * (x + y) // 100
			mylen -= streak
		else:
			got = (pfsums[mylen] - pfsums[streak]) * (x + y) // 100
			if got >= k:
				ans = i
				break
		if mylen >= yprof:
			got += (pfsums[streak + yprof] - pfsums[streak]) * y // 100
			mylen -= yprof
		else:
			got += (pfsums[streak + mylen] - pfsums[streak]) * y // 100
			if got >= k:
				ans = i
				break
		if mylen >= xprof:
			got += (pfsums[streak + yprof + xprof] - pfsums[streak + yprof]) * x // 100
			mylen -= xprof
		else:
			got += (pfsums[streak + mylen + yprof] - pfsums[streak + yprof]) * x // 100
		if got >= k:
			ans = i
			break
	print(ans)


import sys as _sys
I_PROGRAM_INCOME = 0
I_PROGRAM_FREQUENCY = 1
INCOME_DIVISOR = 100

def main():
	q = int(input())
	for i_q in range(q):
		(n,) = _read_ints()
		p = tuple(_read_ints())
		(x, a) = _read_ints()
		(y, b) = _read_ints()
		(k,) = _read_ints()
		result = find_min_tickets_n_to_sell(p, (x, a), (y, b), k)
		print(result)

def _read_line():
	result = _sys.stdin.readline()
	assert result[-1] == '\n'
	return result[:-1]

def _read_ints():
	return map(int, _read_line().split(' '))

def find_min_tickets_n_to_sell(tickets_costs, program_1, program_2, necessary_money):
	tickets_costs = sorted(tickets_costs)
	tickets_n = len(tickets_costs)
	if not _can_accumulate_enough_money(tickets_costs, program_1, program_2, necessary_money):
		return -1
	min_tickets_n_to_sell = 0
	max_tickets_n_to_sell = tickets_n
	while min_tickets_n_to_sell != max_tickets_n_to_sell:
		mid_tickets_n_to_sell = (min_tickets_n_to_sell + max_tickets_n_to_sell) // 2
		if _can_accumulate_enough_money(tickets_costs[tickets_n - mid_tickets_n_to_sell:], program_1, program_2, necessary_money):
			max_tickets_n_to_sell = mid_tickets_n_to_sell
		else:
			min_tickets_n_to_sell = mid_tickets_n_to_sell + 1
	result = min_tickets_n_to_sell
	return result

def _can_accumulate_enough_money(sorted_tickets_costs, program_1, program_2, necessary_money):
	if program_1[I_PROGRAM_INCOME] > program_2[I_PROGRAM_INCOME]:
		(program_1, program_2) = (program_2, program_1)
	assert program_1[I_PROGRAM_INCOME] <= program_2[I_PROGRAM_INCOME]
	sorted_tickets_costs = list(sorted_tickets_costs)
	tickets_n = len(sorted_tickets_costs)
	how_many_1_and_2 = 0
	how_many_1_only = 0
	how_many_2_only = 0
	for i_ticket in range(tickets_n):
		if _does_fit_program(i_ticket, program_1) and _does_fit_program(i_ticket, program_2):
			how_many_1_and_2 += 1
		elif _does_fit_program(i_ticket, program_1):
			how_many_1_only += 1
		elif _does_fit_program(i_ticket, program_2):
			how_many_2_only += 1
	income_1 = program_1[I_PROGRAM_INCOME]
	income_2 = program_2[I_PROGRAM_INCOME]
	income_1_and_2 = income_1 + income_2
	max_money_can_accumulate = 0
	for i in range(how_many_1_and_2):
		max_money_can_accumulate += sorted_tickets_costs.pop() * income_1_and_2 // INCOME_DIVISOR
	for i in range(how_many_2_only):
		max_money_can_accumulate += sorted_tickets_costs.pop() * income_2 // INCOME_DIVISOR
	for i in range(how_many_1_only):
		max_money_can_accumulate += sorted_tickets_costs.pop() * income_1 // INCOME_DIVISOR
	return max_money_can_accumulate >= necessary_money

def _does_fit_program(i_ticket, program):
	return (i_ticket + 1) % program[I_PROGRAM_FREQUENCY] == 0
main()


import sys, math, string, bisect
input = sys.stdin.readline
from collections import deque, defaultdict
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())

def lcm(a, b):
	return a * b // math.gcd(a, b)
q = I()
for _ in range(q):
	n = I()
	l = L()
	(x, p1) = M()
	(y, p2) = M()
	if x < y:
		t = y
		t1 = p2
		y = x
		p2 = p1
		x = t
		p1 = t1
	k = I()
	current = min(p1, p2)
	l.sort(reverse=True)
	d = [0]
	d.append(l[0])
	for i in range(1, n):
		d.append(d[-1] + l[i])
	flag = True
	for i in range(1, n + 1):
		common = i // lcm(p1, p2)
		onlyx = i // p1 - common
		onlyy = i // p2 - common
		index = common
		cost = d[index] * (x + y) // 100
		cost += (d[index + onlyx] - d[index]) * x // 100
		index += onlyx
		cost += (d[index + onlyy] - d[index]) * y // 100
		if cost >= k:
			print(i)
			flag = False
			break
	if flag:
		print(-1)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)

def toord(c):
	return ord(c) - ord('a')
mod = 998244353
INF = float('inf')
from math import factorial, sqrt, ceil, floor, gcd
from collections import Counter, defaultdict, deque
from heapq import heapify, heappop, heappush

def main():
	for _ in range(N()):
		n = N()
		p = RLL()
		(x, a) = RL()
		(y, b) = RL()
		k = N()
		p.sort(reverse=1)

		def c(num):
			(nx, ny, nsub) = (num // a, num // b, num // (a * b // gcd(a, b)))
			nx -= nsub
			ny -= nsub
			sm = 0
			for i in p:
				if nsub > 0:
					sm += i * (x + y) // 100
					nsub -= 1
				elif x > y:
					if nx > 0:
						sm += i * x // 100
						nx -= 1
					elif ny > 0:
						sm += i * y // 100
						ny -= 1
				elif ny > 0:
					sm += i * y // 100
					ny -= 1
				elif nx > 0:
					sm += i * x // 100
					nx -= 1
			return sm
		(l, r) = (0, n)
		res = INF
		while l <= r:
			m = (l + r) // 2
			if c(m) >= k:
				r = m - 1
				res = min(res, m)
			else:
				l = m + 1
		print(res if res != INF else -1)
main()


from collections import Counter, OrderedDict
from itertools import permutations as perm
from collections import deque
from sys import stdin
from bisect import *
from heapq import *
import math
g = lambda : stdin.readline().strip()
gl = lambda : g().split()
gil = lambda : [int(var) for var in gl()]
gfl = lambda : [float(var) for var in gl()]
gcl = lambda : list(g())
gbs = lambda : [int(var) for var in g()]
mod = int(1000000000.0) + 7
inf = float('inf')

def isPos(idx):
	ans = 0
	localPer = []
	for i in range(idx + 1):
		if per[i]:
			localPer.append(per[i])
	localPer.sort(reverse=True)
	for i in range(len(localPer)):
		ans += localPer[i] * p[i]
	return ans >= k
(q,) = gil()
for _ in range(q):
	(n,) = gil()
	p = gil()
	(x, a) = gil()
	(y, b) = gil()
	(k,) = gil()
	per = [0] * n
	for i in range(n):
		p[i] //= 100
		if (i + 1) % a == 0:
			per[i] += x
		if (i + 1) % b == 0:
			per[i] += y
	p.sort(reverse=True)
	ans = -2
	(l, r) = (0, n - 1)
	while l <= r:
		mid = (l + r) // 2
		if isPos(mid):
			ans = mid
			r = mid - 1
		else:
			l = mid + 1
	print(ans + 1)


import sys
input = sys.stdin.readline

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def lcm(a, b):
	return a * b / gcd(a, b)
mod = 10 ** 9 + 7

def main():
	for _ in range(int(input())):
		n = int(input())
		p = list(map(lambda x: int(x) // 100, input().split()))
		new = p
		new.sort()
		new.append(0)
		new.reverse()
		for i in range(1, n + 1):
			new[i] += new[i - 1]
		(x, a) = map(int, input().split())
		(y, b) = map(int, input().split())
		k = int(input())
		d = {}
		d[a] = 0
		d[b] = 0
		d[-1] = 0
		f = -1
		for i in range(1, n + 1):
			if i % a == 0 and i % b != 0:
				d[a] += 1
			elif i % a != 0 and i % b == 0:
				d[b] += 1
			elif i % a == 0 and i % b == 0:
				d[-1] += 1
			curr = 0
			s = []
			left = 0
			s.append([x, d[a]])
			s.append([y, d[b]])
			s.append([x + y, d[-1]])
			s.sort()
			s.reverse()
			for j in s:
				if j[1]:
					curr += (new[j[1] + left] - new[left]) * j[0]
					left += j[1]
			if curr >= k:
				f = i
				break
		print(f)
main()


q = int(input())
out = []
for i in range(q):
	n = int(input())
	p = []
	cont = {}
	for x in input().split():
		el = int(x) // 100
		p.append(el)
	p.sort(reverse=True)
	(x, a) = [int(f) for f in input().split()]
	(y, b) = [int(f) for f in input().split()]
	k = int(input())
	if x < y:
		(y, x) = (x, y)
		(a, b) = (b, a)
	(a1, b1) = (a, b)
	while a1 * b1 != 0:
		if a1 > b1:
			a1 %= b1
		else:
			b1 %= a1
	nok = a * b // (a1 + b1)
	left = 0
	right = n
	while right - left > 1:
		m = (right + left) // 2
		d = 0
		ko = m // nok
		kx = m // a - ko
		ky = m // b - ko
		for t in range(ko):
			d += p[t] * (x + y)
		for t in range(ko, ko + kx):
			d += p[t] * x
		for t in range(ko + kx, ko + kx + ky):
			d += p[t] * y
		cont[m] = d
		if cont[m] < k:
			left = m
		else:
			right = m
	if right in cont.keys():
		if cont[right] >= k:
			out.append(right)
		else:
			out.append(-1)
	else:
		m = right
		d = 0
		ko = m // nok
		kx = m // a - ko
		ky = m // b - ko
		for t in range(ko):
			d += p[t] * (x + y)
		for t in range(ko, ko + kx):
			d += p[t] * x
		for t in range(ko + kx, ko + kx + ky):
			d += p[t] * y
		if d >= k:
			out.append(right)
		else:
			out.append(-1)
for el in out:
	print(el)


from math import gcd

def countDivisibles(A, B, M):
	if A % M == 0:
		return B // M - A // M + 1
	return B // M - A // M
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	(xx, a) = list(map(int, input().split()))
	(y, b) = list(map(int, input().split()))
	if a > b:
		(xx, a, y, b) = (y, b, xx, a)
	k = int(input())
	l = a * b // gcd(a, b)
	arr.sort(reverse=True)
	s = [0] * n
	s[0] = arr[0]
	for i in range(1, n):
		s[i] = s[i - 1] + arr[i]
	ind = -1
	ans = 0
	for i in range(1, n + 1):
		x = countDivisibles(1, i, l)
		x1 = countDivisibles(1, i, b)
		x2 = countDivisibles(1, i, a)
		if x == 0 and x1 != 0 and (x2 != 0):
			ans = max(s[x1 - 1] * y + (s[x1 + (x2 - x) - 1] - s[x1 - 1]) * xx, ans)
			ans = max(s[x2 - 1] * xx + (s[x2 + (x1 - x) - 1] - s[x2 - 1]) * y, ans)
		elif x == 0 and x1 == 0 and (x2 != 0):
			ans = max(s[x2 - 1] * xx, ans)
		elif x != 0 and x1 != 0 and (x2 != 0):
			ans = max(s[x - 1] * (xx + y) + (s[x + (x1 - x) - 1] - s[x - 1]) * y + (s[x + (x1 - x) + (x2 - x) - 1] - s[x + (x1 - x) - 1]) * xx, ans)
			ans = max(s[x - 1] * (xx + y) + (s[x + (x2 - x) - 1] - s[x - 1]) * xx + (s[x + (x2 - x) + (x1 - x) - 1] - s[x + (x2 - x) - 1]) * y, ans)
		if ans >= k * 100:
			ind = i
			break
	print(ind)


import os
import sys
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
ALPHA = 'abcdefghijklmnopqrstuvwxyz'
M = 998244353
EPS = 1e-06

def Ceil(a, b):
	return a // b + int(a % b > 0)

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]

def ok(days):
	freq = ans[:days]
	freq.sort(reverse=True)
	here = 0
	for i in range(days):
		here += freq[i] * p[i]
	return here >= k
for _ in range(Int()):
	n = Int()
	p = [i // 100 for i in array()]
	(x, a) = value()
	(y, b) = value()
	k = Int()
	ans = [0] * n
	p.sort(reverse=True)
	for i in range(1, n + 1):
		if i % a == 0:
			ans[i - 1] += x
		if i % b == 0:
			ans[i - 1] += y
	low = 0
	high = n
	day_need = -1
	while low <= high:
		mid = low + (high - low) // 2
		if ok(mid):
			day_need = mid
			high = mid - 1
		else:
			low = mid + 1
	print(day_need)


import sys
input = sys.stdin.buffer.readline
import math

def count(len, x, a, y, b, lcm, cs):
	cx = len // a
	cy = len // b
	cxy = len // lcm
	cx -= cxy
	cy -= cxy
	return (cs[cxy] - cs[0]) * (x + y) + (cs[cxy + cx] - cs[cxy]) * x + (cs[cxy + cx + cy] - cs[cxy + cx]) * y

def main():
	q = int(input())
	for t in range(q):
		n = int(input())
		p = sorted(list(map(int, input().split())), reverse=True)
		p = [i // 100 for i in p]
		cs = [0] * (n + 1)
		for i in range(n):
			cs[i + 1] = cs[i] + p[i]
		(x, a) = list(map(int, input().split()))
		(y, b) = list(map(int, input().split()))
		if x < y:
			(x, a, y, b) = (y, b, x, a)
		k = int(input())
		lcm = a * b // math.gcd(a, b)
		(low, high) = (1, n + 1)
		f = 0
		while low < high:
			mid = (low + high) // 2
			if count(mid, x, a, y, b, lcm, cs) >= k:
				high = mid
				f = 1
			else:
				low = mid + 1
		if f == 0:
			print(-1)
		else:
			print(low)
main()


def max_contrib(p, amount, n, both, xlist, ylist, a, b):
	collection = j = 0
	for i in both:
		if i > n:
			break
		collection += (x + y) * p[j]
		j += 1
	for i in xlist:
		if i > n:
			break
		collection += x * p[j]
		j += 1
	for i in ylist:
		if i > n:
			break
		collection += y * p[j]
		j += 1
	return collection // 100 >= amount
q = int(input())
for _ in range(q):
	n = int(input())
	p = sorted(list(map(int, input().split())), reverse=True)
	(x, a) = list(map(int, input().split()))
	(y, b) = list(map(int, input().split()))
	if x < y:
		(x, a, y, b) = (y, b, x, a)
	k = int(input())
	(both, xlist, ylist) = ([], [], [])
	for i in range(1, n + 1):
		(div_x, div_y) = (i % a == 0, i % b == 0)
		if div_x and div_y:
			both.append(i)
		elif div_x:
			xlist.append(i)
		elif div_y:
			ylist.append(i)
	(l, r) = (1, len(p) + 1)
	while l < r:
		mid = l + (r - l) // 2
		if max_contrib(p, k, mid, both, xlist, ylist, a, b):
			r = mid
		else:
			l = mid + 1
	result = -1 if l > len(p) else l
	print(result)