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

Solutions:
(a, b, c, d, e, f) = map(int, input().split())
w_m = int(f * 100 / (100 + e)) // 100 * 100
s_m = f * e // (100 + e)
answ = 100 * a
anss = 0
for i in range(w_m // (a * 100) + 1):
	for j in range((w_m - i * a * 100) // (b * 100) + 1):
		w = (i * a + j * b) * 100
		if i == 0 and j == 0:
			w = min(100 * a, 100 * b)
			s_m = f - w
		for k in range(s_m // c + 1):
			for l in range((s_m - k * c) // d + 1):
				s = k * c + l * d
				if anss * (s + w) < s * (anss + answ) and s * (100 + e) <= e * (s + w):
					answ = w
					anss = s
print(answ + anss, anss)


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


from decimal import Decimal as D
(mi1, mi2, sa1, sa2, houwa, lim) = map(int, input().split())
slim = houwa * lim // (100 + houwa)
ws = set((mi1 * i + mi2 * j for i in range(lim // (100 * mi1) + 2) for j in range(lim // (100 * mi2) + 2) if 100 * (mi1 * i + mi2 * j) <= lim))
ss = set((sa1 * i + sa2 * j for i in range(slim // sa1 + 2) for j in range(slim // sa2 + 2) if sa1 * i + sa2 * j <= slim))
ans = D('0')
(iw, isa) = (mi1, 0)
for s in ss:
	for w in ws:
		if s > houwa * w or w == 0:
			continue
		if ans < D(str(10000 * s)) / D(str(s + 100 * w)) and s + 100 * w <= lim:
			ans = D(str(10000 * s)) / D(str(s + 100 * w))
			(isa, iw) = (s, w)
print(100 * iw + isa, isa)


(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())
L = []
for a in range(31):
	for b in range(31):
		k = A * a + B * b
		if 0 < 100 * k <= F:
			L.append(k)
L.sort()
su = 0
for (i, l) in enumerate(L):
	limit = min(F - 100 * l, E * l)
	wd = 100 * l
	if i == 0:
		w = wd
	for c in range(3000):
		if C * c > limit:
			break
		d = (limit - C * c) // D
		p = C * c + D * d
		if p * w > wd * su:
			w = wd
			su = p
print(w + su, su)


(A, B, C, D, E, F) = map(int, input().split())
W = sorted(list({a * 100 * A + b * 100 * B for a in range(F // 100 // A + 1) for b in range(F // 100 // B + 1) if a * 100 * A + b * 100 * B <= F}))
S = [max([c * C + d * D for c in range(int(E * w / 100 / C) + 1) for d in range(int(E * w / 100 / D) + 1) if (c * C + d * D) * 100 <= E * w and c * C + d * D + w <= F]) for w in W]
I = sorted([i for i in range(len(W))], key=lambda i: W[i] / (W[i] + S[i]) if W[i] > 0 else 1)[0]
print(100 * A if W[I] == 0 else W[I] + S[I], S[I])


(A, B, C, D, E, F) = map(int, input().split())
X = [1] + [0] * F
Y = [1] + [0] * F
for i in range(1, F + 1):
	if i >= A * 100 and X[i - A * 100]:
		X[i] = 1
	if i >= B * 100 and X[i - B * 100]:
		X[i] = 1
	if i >= C and Y[i - C]:
		Y[i] = 1
	if i >= D and Y[i - D]:
		Y[i] = 1
ans = (0, 0)
ratio = -1
for i in range(100, F + 1, 100):
	for j in range(F + 1):
		if X[i] and Y[j]:
			if j <= i // 100 * E and i + j <= F:
				if j / i > ratio:
					ans = (i + j, j)
					ratio = j / i
print(*ans)


from itertools import product
(a, b, c, d, e, f) = map(int, input().split())
A = sorted(list(set(filter(lambda x: 100 * x <= f and x, [i * a + j * b for (i, j) in product(range(31), range(16))]))))
B = [min(x * e, f - 100 * x) for x in A]
C = []
for i in range(len(A)):
	m = 0
	for k in range(29):
		if k * d <= B[i]:
			m = max(m, k * d + (B[i] - k * d) // c * c)
	C.append(m)
Table = [100 * a, 0]
for (x, y) in zip(A, C):
	if y / (100 * x + y) > Table[1] / Table[0]:
		Table = [100 * x + y, y]
print(Table[0], Table[1])


(a, b, c, d, e, f) = map(int, input().split())
F = f // 100
E = e / (e + 100)
ans = [100 * a, 0]
W = {i + j for i in range(0, F + 1, a) for j in range(0, F + 1, b)}
W = sorted(W)[1:]
for k in W:
	w = 100 * k
	for i in range(0, f + 1, c):
		for j in range(0, f + 1, d):
			s = i + j
			n = s / (w + s)
			if w + s > f or n > E:
				break
			if ans[1] / ans[0] < n:
				ans = [w + s, s]
print(ans[0], ans[1])