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: interview

Starter code:

Solutions:
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 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 math import gcd
def check(m):
    nonlocal 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
        #print(p[i], end = ' ')
    if x >= y:
        for i in range(kxy, kxy + kx):
            ans += p[i] * x // 100
            #print(p[i],end = ' ')
        
        for i in range(kxy + kx, kxy + kx + ky):
            ans += p[i] * y // 100
            #print(p[i],end = ' ')
    else:
        for i in range(kxy, kxy + ky):
            ans += p[i] * y // 100
    #        print(p[i],end = ' ')
        
        for i in range(kxy + ky, kxy + kx + ky):
            ans += p[i] * x // 100
     #       print(p[i],end = ' ')
    #print("!!!!")
    #print('III', ans, m)
    return ans
    

p = []
for i in range(int(input())):
    n = int(input())
    p = sorted(map(int, input().split()), reverse=True)
    x, a = list(map(int, input().split()))
    y, b = list(map(int, input().split()))
    k = int(input())
    l = 0
    r = n
    if check(n) < k:
        print(-1)
        #print()
        continue
    else:
        while r - l > 1:
            m = (r + l) // 2
            if check(m) >= k:
                r =  m
            else:
                l = m
        print(r)
        #print()


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)
'''
    count_double = n // (a * b // gcd(a, b))
    #print(n // a + n // b - count_double)
    maximals = sorted(arr, reverse=True)[:(n // a + n // b - count_double)]
    ans = 0
    for i in maximals[:count_double]:
        ans += (x + y) * i
    maximals = maximals[count_double:]

    count_a = n // a - count_double
    count_b = n // b - count_double
    for i in maximals[:count_a]:
        ans += x * i
    for i in maximals[count_a:]:
        ans += y * i

    print(ans, k, ans >= k)
'''

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


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


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


def f():
    n = int(input())
    p = list([int(x)//100 for x in input().split()])
    x, a = list(map(int, input().split()))
    y, b = list(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
#    print(p, ps, cola, colb, colab, k, res, ps[colab]*(x+y), (ps[colab + cola] - ps[colab])*x, (ps[colab+cola+colb] - ps[colab+cola])*y)
    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())


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 = list(map(int, input().split()))
    y, b = list(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)


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)

from math import *
for _ in range(int(input())):
    n = int(input())
    a = list(map(int, input().split()))
    z, x = list(map(int, input().split()))
    t, y = list(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)


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
    #print(arr[:GdCN], arr[GdCN:GdCN + GCN], arr[GdCN + GCN:GdCN + GCN + BCN])
    #print(mid, GdCN, GCN, BCN, sum(arr[:GdCN]) * ((x + y) // 100) + sum(arr[GdCN:GdCN + GCN]) * (MAP // 100) + sum(arr[GdCN + GCN:GdCN + GCN + BCN]) * (MIP // 100))
    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)
    #print('--------------------------------------------------')


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
#        s = sum(p[:np3]) / 100 * (x + y) + sum(p[np3:np3 + np1]) / 100 * x + sum(p[np1 + np3:np1 + np2 + np3]) / 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 line():
    return list(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 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)

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)


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)


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)




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 = list(map(int, input().split()))
    y, b = list(map(int, input().split()))
    k = int(input())

    #preprocessing
    c = a*b//gcd(a,b)
    if y>x:
        x, y = y, x
        a, b = b, a

    #aux fxn to find whether m tickets suffice
    def check(m):
        add = 0
        hc = m//c
        ha = m//a - hc
        hb = m//b - hc
        #print("aajo")
        #print(m,hc,ha,hb)
        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

    #lower bound using check fxn
    lo, hi = 1, n
    ans = -1
    
    while(lo <= hi):
        mid = (lo + hi)//2
        val = check(mid)
        #print("check")
        #print(mid, val)
        if val >= k:
            ans = mid
            hi = mid - 1
        #elif val > k:
        #    ans = mid
        #    hi = mid - 1
        else:
            lo = mid + 1
        
    print(ans)



from collections import deque
n = int(input())
for _ in range(n):
    m = int(input())  # number tickets
    tickets = list(map(int, input().split()))
    tickets.sort(reverse=True)
    aperc, ajump = list(map(int, input().split()))
    bperc, bjump = list(map(int, input().split()))
    q = int(input())  # req total
    if bperc > aperc:
        bperc, aperc = aperc, bperc
        ajump, bjump = bjump, ajump
    # a is bigger
    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
        # print(f"i:{i}, sum:{sumo}")
        # print(da)
        # print(db)
        # print(dc)
        # print(" ")
        if(sumo >= q and (not zet)):
            zet = True
            ans = i+1
            break

    print(ans)


from collections import deque
n = int(input())
for _ in range(n):
    m = int(input())  # number tickets
    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())  # req total
    if bperc > aperc:
        bperc, aperc = aperc, bperc
        ajump, bjump = bjump, ajump
    # a is bigger
    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
        # print(f"i:{i}, sum:{sumo}")
        # print(da)
        # print(db)
        # print(dc)
        # print(" ")
        if(sumo >= q and (not zet)):
            zet = True
            ans = i+1
            break
 
    print(ans)

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 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 calc(arr, ll, a, b, x, y):
    # y is always greater than x
    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)