Snuke is making sugar water in a beaker.
Initially, the beaker is empty. Snuke can perform the following four types of operations any number of times. He may choose not to perform some types of operations.
 - Operation 1: Pour 100A grams of water into the beaker.
 - Operation 2: Pour 100B grams of water into the beaker.
 - Operation 3: Put C grams of sugar into the beaker.
 - Operation 4: Put D grams of sugar into the beaker.
In our experimental environment, E grams of sugar can dissolve into 100 grams of water.
Snuke will make sugar water with the highest possible density.
The beaker can contain at most F grams of substances (water and sugar combined), and there must not be any undissolved sugar in the beaker.
Find the mass of the sugar water Snuke will make, and the mass of sugar dissolved in it.
If there is more than one candidate, any of them will be accepted.
We remind you that the sugar water that contains a grams of water and b grams of sugar is \frac{100b}{a + b} percent.
Also, in this problem, pure water that does not contain any sugar is regarded as 0 percent density sugar water.

-----Constraints-----
 - 1 \leq A < B \leq 30
 - 1 \leq C < D \leq 30
 - 1 \leq E \leq 100
 - 100A \leq F \leq 3 000
 - A, B, C, D, E and F are all integers.

-----Inputs-----
Input is given from Standard Input in the following format:
A B C D E F

-----Outputs-----
Print two integers separated by a space.
The first integer should be the mass of the desired sugar water, and the second should be the mass of the sugar dissolved in it.

-----Sample Input-----
1 2 10 20 15 200

-----Sample Output-----
110 10

In this environment, 15 grams of sugar can dissolve into 100 grams of water, and the beaker can contain at most 200 grams of substances.
We can make 110 grams of sugar water by performing Operation 1 once and Operation 3 once.
It is not possible to make sugar water with higher density.
For example, the following sequences of operations are infeasible:
 - If we perform Operation 1 once and Operation 4 once, there will be undissolved sugar in the beaker.
 - If we perform Operation 2 once and Operation 3 three times, the mass of substances in the beaker will exceed 200 grams.

Difficulty: introductory

Starter code:

Solutions:
a, b, c, d, e, f = map(int, input().split())
s = set()
for i in range(30 // a + 1):
    for j in range(30 // b + 1):
        if 0 < (a * i + b * j) * 100 <= f:
            s = s | {a * i + b * j}
s2 = set()
for i in range(3000 // c + 1):
    for j in range(3000 // d + 1):
        if c * i + d * j <= f:
            s2 = s2 | {c * i + d * j}
ans = []
for i in s:
    for j in s2:
        if i * 100 + j <= f and j <= i * e:
            ans.append([j / i * -1, i * 100 + j, j])
ans.sort()
print(ans[0][1], ans[0][2])

A,B,C,D,E,F = map(int,input().split())

concentration = 0
ans = [A*100,0]

water = []
for a in range(F//(A*100) + 1):
  for b in range(((F-a*A*100)//(B*100))+1):
    water.append((a*A+b*B)*100)
    
water = sorted(list(set(water)))

sugar = []
for c in range(F//C + 1):
  for d in range(((F - c*C)//D)+1):
    sugar.append(c*C+d*D)
sugar = sorted(list(set(sugar)))


for wa in water:
  for su in sugar:
    if wa + su <= F:
      if su <= (wa/100)*E:
        if wa != 0:
          if concentration < su/(su+wa):
            concentration = su/(su+wa)
            ans = [su+wa,su]

print(" ".join(map(str,ans)))

A,B,C,D,E,F = map(int,input().split())
mx =- 1
S = set()
W = set()

for a in range(0,F+1,100*A):
  for b in range(0,F+1-a,100*B):
    W.add(a+b)

for c in range(0,F+1,C):
  for d in range(0,F+1-c,D):
    S.add(c+d)

for w in W:
  for s in S:
    if 0<w+s<=F and s<=w*E//100:
      if mx<s/(w+s):
        ans=w+s,s
        mx=s/(w+s)

print(ans[0],ans[1])

a,b,c,d,e,f=map(int,input().split())
w=set()
for i in range(0,f,100*a):
    for j in range(0,f,100*b):
        if i+j<=f:
            w.add(i+j)
        else:
            break
s=set()
for i in range(0,f,c):
    for j in range(0,f,d):
        if i+j<=f:
            s.add(i+j)
        else:
            break
n=100*a
m=0
l=0
for x in w:
    for t in s:
        if x+t!=0 and x+t<=f and 100*t<=e*x and t/(x+t)>l:
            n=x+t
            m=t
            l=t/(x+t)
print(n,m)

A,B,C,D,E,F = map(int,input().split())
mx =- 1
S = set()
W = set()

for a in range(0,F+1,100*A):
  for b in range(0,F+1-a,100*B):
    W.add(a+b)

for c in range(0,F+1,C):
  for d in range(0,F+1-c,D):
    S.add(c+d)

for w in W:
  for s in S:
    if 0<w+s<=F and s<=w*E//100:
      if mx<s/(w+s):
        ans=w+s,s
        mx=s/(w+s)

print(ans[0],ans[1])

a, b, c, d, e, f = map(int, input().split())

water = [False] * (f//100 + 1)
for i in range(0, len(water), a):
    water[i] = True
for i in range(len(water) - b):
    if water[i]:
        water[i + b] = True

sugar = [False] * ((f//100) * e + 1)
for i in range(0, len(sugar), c):
    sugar[i] = True
for i in range(len(sugar) - d):
    if sugar[i]:
        sugar[i + d] = True

# denominator: 分母, numerator: 分子
deno = a * 100
nume = 0

for i in range(1, len(water)):
    if water[i]:
        j = min([i*e, f - 100*i])
        while not sugar[j]:
            j -= 1
        i = 100 * i + j

        if nume * i < deno * j:
            deno = i
            nume = j

print(deno, nume)

a, b, c, d, e, f = map(int, input().split())
W = set(); S = set()
sa = 0; wsa = a * 100
for i in range(0, f + a * 100, a * 100):
    for j in range(0, f + b * 100, b * 100):
        w = i + j
        if w <= f:
            W.add(w)
        else:
            break
for i in range(0, f // 2 + c, c):
    for j in range(0, f // 2 + d, d):
        s = i + j
        if s <= f // 2:
            S.add(s)
        else:
            break
S.remove(0)
for i in W:
    for j in S:
        if e / (100 + e) >= j / (i + j) > sa / wsa and i + j <= f:
            sa, wsa = j, i + j
print(wsa, sa)

import bisect, heapq

a, b, c, d, e, f = map(int, input().split())

w = set()
temp = [a * i for i in range((30 - 1) // a + 2)]
for i in temp:
    while i not in w and i <= 30:
        w.add(i)
        i += b
w = list(w)
w.remove(0)
w.sort()

s = set()
temp = [c * i for i in range((3000 - 1) // c + 2)]
for i in temp:
    while i not in s and i <= 3000:
        s.add(i)
        i += d
s = list(s)
s.sort()

queue = []
heapq.heapify(queue)
for i in w:
    if i * 100 > f:
        continue
    num = bisect.bisect(s, i * e)
    for j in range(num - 1, -1, -1):
        if i * 100 + s[j] > f:
            continue
        heapq.heappush(queue, [-s[j] / i, 100 * i + s[j], s[j]])
        break
print(queue[0][1], queue[0][2])

a, b, c, d, e, f = map(int, input().split())

ans = -1
ans_water = -1
ans_sugar = -1
for ia in range(f//(a*100)+2):
    water = 100*a*ia
    if water > f or water == 0: continue
    for ib in range(f//(b*100)+2):
        if ib != 0: water += 100*b
        if water > f or water == 0: continue
        for ic in range(f//c+1):
            sugar = c*ic
            if sugar/(water//100) > e: continue
            for id in range(f//d+1):
                if id != 0: sugar+=d
                if sugar/(water//100) > e: continue
                if sugar + water > f: continue
                if (100*sugar)/(sugar+water) > ans:
                    ans = (100*sugar)/(sugar+water)
                    ans_water = water
                    ans_sugar = sugar
print(ans_sugar+ans_water, ans_sugar)

a,b,c,d,e,f=map(int,input().split())
ans=[-1]*9999
ans[a*100]=0
ans[b*100]=0
fin=[a*100,0]
p=0
for i in range(1,f+1):
    if ans[i]==-1:
        continue
    if (ans[i]+c)/(i-ans[i])<=e*0.01:
        ans[i+c]=max(ans[i]+c,ans[i+c])
    if (ans[i]+d)/(i-ans[i])<=e*0.01:
        ans[i+d]=max(ans[i]+d,ans[i+d])
    ans[i+a*100]=max(ans[i+a*100],ans[i])
    ans[i+b*100]=max(ans[i+b*100],ans[i])
    if ans[i]/i>p:
        p=ans[i]/i
        fin=[i,ans[i]]
print(*fin)

a,b,c,d,e,f = map(int,input().split())
ans = [-1]*10000
# ans[0] = 0
ans[a*100] = 0
ans[b*100] = 0
q1 = a*100
q2 = b*100
p = 0
fin = [a*100,0]
for i in range(1,f+1):
    if ans[i] == -1:
        continue
    if (ans[i]+c)/(i-ans[i]) <= e*0.01:
        ans[i+c] = max(ans[i]+c,ans[i+c])
    if (ans[i]+d)/(i-ans[i]) <= e*0.01:
        ans[i+d] = max(ans[i]+d,ans[i+d])
    ans[i+a*100] = max(ans[i+a*100],ans[i])
    ans[i+b*100] = max(ans[i+b*100],ans[i])
    if i != 0:
        if ans[i]/i > p:
            # print(p,i)
            p = ans[i]/i
            fin = [i,ans[i]]
# print(ans[190:210])
print(*fin)

A,B,C,D,E,F = (int(T) for T in input().split())
SugM = 0
WatM = 100*A
for TC in range(0,F+1):
    for TD in range(0,F+1):
        Suger = C*TC+D*TD
        RestS = F-Suger
        if RestS>=0:
            for TA in range(0,(RestS//100)+1):
                for TB in range(0,(RestS//100)+1):
                    if TA==TB==0:
                        continue
                    else:
                        Water = TA*A*100+TB*B*100
                        RestW = RestS-Water
                        if RestW>=0 and Water>=(100*Suger)/E:
                            if SugM/(WatM+SugM)<Suger/(Water+Suger):
                                SugM = Suger
                                WatM = Water
                        else:
                            break
        else:
            break
print('{} {}'.format(WatM+SugM,SugM))

a,b,c,d,e,f=map(int,input().split())

max_s=0
max_w=a
max_conc=0

water_s=set()
sugar_s=set()
for i in range(f//a//100+1):
  aa=a*i
  for j in range(f//b//100+1):
    bb=b*j
    if aa+bb <= f//100:
      water_s.add(aa+bb)
      
for i in range(f//c+1):
  cc=c*i
  for j in range(f//d+1):
    dd=d*j
    if cc+dd <= f:
      sugar_s.add(cc+dd)

for w in water_s:
  for sg in sugar_s:
    if w*100+sg <= f and w*e >= sg and w+sg > 0:
      conc=(100*sg)/(100*w+sg)
      if max_conc < conc:
        max_conc=conc
        max_w=w
        max_s=sg
print(max_w*100+max_s,max_s)

a,b,c,d,e,f=map(int,input().split())
g=[-1]*9999
g[a*100]=0
g[b*100]=0
h=[a*100,0]
p=0
for i in range(1,f+1):
    if g[i]==-1:
        continue
    if (g[i]+c)/(i-g[i])<=e*0.01:
        g[i+c]=max(g[i]+c,g[i+c])
    if (g[i]+d)/(i-g[i])<=e*0.01:
        g[i+d]=max(g[i]+d,g[i+d])
    g[i+a*100]=max(g[i+a*100],g[i])
    g[i+b*100]=max(g[i+b*100],g[i])
    if g[i]/i>p:
        p=g[i]/i
        h=[i,g[i]]
print(*h)

import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    A, B, C, D, E, F = list(map(int, input().split()))

    water = set()
    for a in range(F // (A * 100) + 1):
        for b in range(F // (B * 100) + 1):
            if 0 < a * 100 * A + b * 100 * B <= F:
                water.add(a * 100 * A + b * 100 * B)

    kouho = []
    for w in water:
        ma = (E * w) // 100
        for c in range(ma // C + 1):
            for d in range(ma // D + 1):
                sugar = c * C + d * D
                if 0 < sugar <= ma and w + sugar <= F:
                    kouho.append([w, sugar])

    if len(kouho) == 0:
        print((list(water)[0], 0))
        return

    max_noudo = 0
    res = []
    for w, sugar in kouho:
        noudo = sugar / (w + sugar)
        if max_noudo < noudo:
            max_noudo = noudo
            res = [w + sugar, sugar]
    print((*res))


def __starting_point():
    resolve()

__starting_point()

a , b , c , d , e , f = map(int,input().split())
midp = [-1 for i in range(f+1)]
mizu = []
midp[0] = 0
for i in range(f+1):
    if midp[i] != -1:
        if i + a*100 <= f and midp[i+a*100] != 0:
            midp[i+a*100] = 0
            mizu.append(i+a*100)
        if i + b*100 <= f and midp[i+b*100] != 0:
            midp[i+b*100] = 0
            mizu.append(i+b*100)
ans = 0
cou = [a*100,0]
for i in mizu:
    sai = i*e//100
    sadp = [-1 for f in range(sai+1)]
    sadp[0] = 0
    maxsa = 0
    for j in range(sai+1):
        if sadp[j] != -1:
            if j + c <= sai and i + j + c <= f and sadp[j+c] != 0:
                sadp[j+c] = 0
                maxsa = max(maxsa,j+c)
            if j + d <= sai and i + j + d <= f and sadp[j+d] != 0:
                sadp[j+d] = 0
                maxsa = max(maxsa,j+d)
    if ans < maxsa/(i+maxsa):
        ans = maxsa/(i+maxsa)
        cou = [i+maxsa,maxsa]

print(*cou)

A,B,C,D,E,F = map(int,input().split())

ws = set()
for a in range(0,F+1,100*A):
    for b in range(0,F+1,100*B):
        if a+b > F: break
        ws.add(a+b)
ws.remove(0)

ss = set()
for c in range(0,F+1,C):
    for d in range(0,F+1,D):
        if c+d > F: break
        ss.add(c+d)

best_s = -1
best_w = 1
for w in ws:
    for s in ss:
        if w+s > F: continue
        if E*w < s*100: continue
        if best_s * (s+w) < s * (best_s + best_w):
            best_s = s
            best_w = w
print(best_s+best_w, best_s)

a, b, c, d, e, f = map(int, input().split())
W = set(); S = set()
sa = 0; wsa = a * 100

for i in range(0, f + a * 100, a * 100):
    for j in range(0, f + b * 100, b * 100):
        w = i + j
        if w <= f:
            W.add(w)
        else:
            break
for i in range(0, f // 2 + c, c):
    for j in range(0, f // 2 + d, d):
        s = i + j
        if s <= f // 2:
            S.add(s)
        else:
            break
S.remove(0)
for i in W:
    for j in S:
        if e / (100 + e) >= j / (i + j) > sa / wsa and i + j <= f:
            sa, wsa = j, i + j
print(wsa, sa)

a,b,c,d,e,f=map(int,input().split())
a=100*a
b=100*b
dp1=[0]*(f+1)
dp2=[0]*(f+1)
for i in range(f+1):
    if i%a==0:
        if i+a<=f:
            dp1[i+a]=1
for i in range(f+1):
    if i==0 or dp1[i]==1:
        if i+b<=f:
            dp1[i+b]=1
for i in range(f+1):
    if i%c==0:
        if i+c<=f:
            dp2[i+c]=1
for i in range(f+1):
    if i==0 or dp2[i]==1:
        if i+d<=f:
            dp2[i+d]=1

ans=[-1,-1,-1]
for i in range(f+1):
    if dp1[i]==1:
        x=min(f-i,(i//100)*e)
        k=-1
        for j in range(x,-1,-1):
            if dp2[j]==1 or j==0:
                k=j
                if ans[0]<100*k/(i+k):
                    ans=[100*k/(i+k),i+k,k]
                break
print(str(ans[1])+" "+str(ans[2]))

import sys

input = sys.stdin.readline


def main():
    A, B, C, D, E, F = list(map(int, input().split()))

    max_concentration = 0
    ans = (100 * A, 0)
    for a in range(0, F + 1, 100 * A):
        for b in range(0, F - a + 1, 100 * B):
            water = a + b
            if water == 0:
                break
            for c in range(0, F - water + 1, C):
                for d in range(0, F - water - c + 1, D):
                    sugar = c + d
                    if sugar > (water // 100) * E:
                        break
                    concentration = (100 * sugar) / (water + sugar)
                    if concentration > max_concentration:
                        max_concentration = concentration
                        ans = (water + sugar, sugar)

    print((" ".join(map(str, ans))))


def __starting_point():
    main()

__starting_point()

A,B,C,D,E,F=map(int,input().split(' '))
water = set()
for a in range(0,F,100*A):
  for b in range(0,F,100*B):
    if a+b <= F:
      water.add(a+b)
    else:
      break
sugars = set()
for c in range(0,F,C):
  for d in range(0,F,D):
    if c+d <= F:
      sugars.add(c+d)
    else:
      break
density = 0
sugar = 0
content = 100*A
for x in water:
  for y in sugars:
    if x+y != 0 and x+y <= F and E*x >= 100*y and density < y/(x+y):
      density = y/(x+y)
      sugar = y
      content = x+y
print(content,sugar)

def main():
	A, B, C, D, E, F = map(int, input().split())
	water = set()
	sugar = set()

	for i in range(F // (100 * A) + 1):
		for j in range(F // (100 * B) + 1):
			water_amount = 100 * A * i + 100 * B * j
			if 0 < water_amount and water_amount <= F:
				water.add(water_amount)

	for i in range(F // C + 1):
		for j in range(F // D + 1):
			sugar_amount = C * i + D * j
			if sugar_amount <= F:
				sugar.add(sugar_amount)

	# print(water)
	# print(sugar)

	max_c = -1
	max_w = 0
	max_s = 0

	for w in water:
		for s in sugar:
			if w + s <= F:
				if s / w <= E / 100:
					if s * 100 / (w + s) > max_c:
						max_c = s * 100 / (w + s)
						max_w = w
						max_s = s

	print(max_w + max_s, max_s)

 
def __starting_point():
  	main()
__starting_point()