Snuke is making sugar water in a beaker. Initially, the beaker is empty. Snuke can perform four types of operations any number of times: pouring 100A or 100B grams of water, and putting C or D grams of sugar into the beaker. E grams of sugar can dissolve into 100 grams of water. Snuke aims to make sugar water with the highest possible density, ensuring the beaker can contain at most F grams of substances without any undissolved sugar. The task is to find the mass of the sugar water Snuke will make and the mass of sugar dissolved in it. The output should be two integers separated by a space. The first integer represents the mass of the desired sugar water, and the second represents the mass of the sugar dissolved in it. The constraints are: 1 ≤ A < B ≤ 30, 1 ≤ C < D ≤ 30, 1 ≤ E ≤ 100, and 100A ≤ F ≤ 3000. Inputs are given in the format A B C D E F, and the outputs should be two integers.

# Buggy version:
a,b,c,d,e,f=map(int,input().split())

water=set()#入れる可能性のある水の量O(A*B)
sugar=set()#入れる可能性のある佐藤の量O(C*D)

for i in range(31):
    for j in range(31):
        water.add(100*i*a+100*j*b)

for i in range(1501):
    for j in range(1501):
        sugar.add(c*i+d*j)
water=sorted(list(water))
#print(water)
sugar=sorted(list(sugar))
#print(sugar)
ans=0
sumans=0
for i in range(1,len(water)):
    for j in range(len(sugar)):
        if water[i]+sugar[j]<=f and (sugar[j]/(water[i]//100))<=e:
            if ans<(100*sugar[j])//(water[i]+sugar[j]):
                #print(sugar[j],water[j])
                ans=(100*sugar[j])/(water[i]+sugar[j])
                sugarans=sugar[j]
                sumans=water[i]+sugar[j]
print(sumans,sugarans)


# Fixed version:
a,b,c,d,e,f=map(int,input().split())

water=set()#入れる可能性のある水の量O(A*B)
sugar=set()#入れる可能性のある佐藤の量O(C*D)

for i in range(31):
    for j in range(31):
        if 100*i*a+100*j*b<=f:
            water.add(100*i*a+100*j*b)

for i in range(1501):
    for j in range(1501):
        if c*i+d*j<=f:
            sugar.add(c*i+d*j)
water=sorted(list(water))
#print(water)
#print(sugar)
sugar=sorted(list(sugar))
#print(sugar)
ans=0
sugarans=0
sumans=0
for i in range(1,len(water)):
    for j in range(len(sugar)):
        if water[i]+sugar[j]<=f and sugar[j]<=e*(water[i]/100):
            if ans<(100*sugar[j])/(water[i]+sugar[j]):
                #print(sugar[j],water[j])
                ans=(100*sugar[j])/(water[i]+sugar[j])
                sugarans=sugar[j]
                sumans=water[i]+sugar[j]
               # print(ans)
if  sumans==0:
    print(100*a,sugarans)
else:
    print(sumans,sugarans)

# Buggy version:
A,B,C,D,E,F=[int(x) for x in input().split()]
from itertools import product
def gauss(i):
    return F//i+1
waters=set()
sugers=set()
ans=(100*A,0)
for a,b in product(range(gauss(A)),range(gauss(B))):
    waters.add(100*(a*A+b*B))
for c,d in product(range(gauss(C)),range(gauss(D))):
    sugers.add(c*C+d*D)
for water,suger in product(waters,sugers):
    if water==0:
        continue
    if water+suger>F:
        continue
    if 100*suger>E*(water+suger):
        continue
    if ans[1]*(water+suger)<suger*ans[0]:
        ans=(water+suger,suger)
print(ans)

# Fixed version:
A,B,C,D,E,F=[int(x) for x in input().split()]
from itertools import product
def gauss(i):
    return F//i+1
waters=set()
sugers=set()
ans={"water":100*A,"suger":0}
for a,b in product(range(gauss(A)),range(gauss(B))):
    waters.add(100*(a*A+b*B))
for c,d in product(range(gauss(C)),range(gauss(D))):
    sugers.add(c*C+d*D)
for water in sorted(waters):
    if water==0:
        continue
    for suger in sorted(sugers):
        if water+suger>F:
            break
        if 100*suger>E*water:
            break
        if ans["suger"]*(water+suger)<suger*ans["water"]:
            ans={"water":water+suger,"suger":suger}
print(ans["water"],ans["suger"])

# Buggy version:
a,b,c,d,e,f=map(int,input().split())
w_m=-(-f//(100+e))*100
s_m=f//(100+e)*e
noudo=0
answ=0
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 w==0:
            pass
        else:
            for k in range(s_m//c+1):
                for l in range((s_m-k*c)//d+1):
                    s=k*c+l*d
                    if (noudo<s/(s+w)) and (s/(s+w)<=e/(100+e)):
                        noudo=s/(s+w)
                        answ=w
                        anss=s
print(answ+anss,anss)


# Fixed version:
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)

# Buggy version:
A, B, C, D, E, F = [int(v) for v in input().split()]
# print(A, B, C, D, E, F)
An = [(100*A)*(v) for v in range(int(F/(100*A))+1)]
Bn = [(100*B)*(v) for v in range(int(F/(100*B))+1)]
# print(An, Bn, 1)


def per1(RE):
  Cn = [A*v for v in range(int(RE/A)+1)]
  Dn = [B*v for v in range(int(RE/B)+1)]
  # print(int(RE/C))
  rtn = 0
  for v2 in Cn:
    for w2 in Dn:
      r = v2 + w2
      if rtn < r <= RE:
        rtn = r
  return rtn
  
  
max_suger_per = 0
max_water = 0
max_suger = 0
for v in Bn:
  for w in An:
    s = v + w
    if s > F or s == 0: continue
    re = int(s * E / 100)
    if s + re > F: re = F - s
    # print(s, re)
    result = per1(re)
    # print(result)
    suger = (100 * result) / (s + result)
    if suger > max_suger_per:
      max_suger_per = suger
      max_water = s + result
      max_suger = result
    
print(max_water, max_suger)
  

# Fixed version:
A, B, C, D, E, F = [int(v) for v in input().split()]
# print(A, B, C, D, E, F)
An = [(100*A)*(v) for v in range(int(F/(100*A))+1)]
Bn = [(100*B)*(v) for v in range(int(F/(100*B))+1)]
# print(An, Bn, 1)
 
 
def per1(RE):
  Cn = [C*v for v in range(int(RE/C)+1)]
  Dn = [D*v for v in range(int(RE/D)+1)]
  rtn = 0
  for v2 in Cn:
    for w2 in Dn:
      r = v2 + w2
      if rtn < r <= RE:
        rtn = r
  return rtn
  
  
max_suger_per = 0
max_water = 0
max_suger = 0
for v in Bn:
  for w in An:
    s = v + w
    if s > F or s == 0: continue
    re = int(s * E / 100)
    if s + re > F: re = F - s
    # print(s, re)
    result = per1(re)
    # print(result)
    suger = (100 * result) / (s + result)
    if suger > max_suger_per:
      max_suger_per = suger
      max_water = s + result
      max_suger = result
    
if max_water == 0:
  max_water = An[1]
print(max_water, max_suger)

# Buggy version:
a, b, c, d, e, f = map(int, input().split())
w = []
s = []
for i in range(f // (100 * a) + 1):
  for j in range((f - 100 * a * i) // (100 * b) + 1):
    if 100 * a * i + 100 * b * j <= f:
      w.append(100 * a * i + 100 * b * j)
for i in range(f // c + 1):
  for j in range((f - c * i) // d + 1):
    if c * i + d * j <= f:
      s.append(c * i + d * j)
ans = (100 * a, 0)
l = 0
for i in w:
  for j in range(l, len(s)):
    if i + s[j] > f:
      break
    if s[j] > i // 100 * e:
      break
    if ans[1] * i < s[j] * ans[0]:
      ans = (i, s[j])
      l = j
print(ans[0] + ans[1], ans[1])


# Fixed version:
a, b, c, d, e, f = map(int, input().split())
w = []
s = []
for i in range(f // (100 * a) + 1):
  for j in range((f - 100 * a * i) // (100 * b) + 1):
    if 100 * a * i + 100 * b * j <= f:
      w.append(100 * a * i + 100 * b * j)
for i in range(f // c + 1):
  for j in range((f - c * i) // d + 1):
    if c * i + d * j <= f:
      s.append(c * i + d * j)
w.sort()
s.sort()
ans = (100 * a, 0)
l = 0
for i in w:
  for j in range(l, len(s)):
    if i + s[j] > f:
      break
    if s[j] > i // 100 * e:
      break
    l = j
    if ans[1] * i < s[j] * ans[0]:
      ans = (i, s[j])
print(ans[0] + ans[1], ans[1])

# Buggy version:
#!/usr/bin/env python3
import sys


def v(a: int, b: int, c: int):
    if a < b:
        a, b = b, a
    if c % a == 0:
        return c
    minr = c
    for va in range(c // a + 1):
        minr = min(minr, (c - va * a) % b)
        if minr == 0:
            break
    return c - minr


def solve(A: int, B: int, C: int, D: int, E: int, F: int):
    ansa = 0
    anss = 0
    for w in range(1, F // 100 + 1):
        w2 = v(A, B, w)
        if w != w2:
            continue
        s = w2 * E
        s2 = v(C, D, s)
        a2 = s2 + w2 * 100
        if a2 > F:
            continue
        # anss / ansa <= s2 / a2
        if anss * a2 <= ansa * s2:
            ansa, anss = 100 * w2 + s2, s2
    print(ansa, anss)


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    D = int(next(tokens))  # type: int
    E = int(next(tokens))  # type: int
    F = int(next(tokens))  # type: int
    solve(A, B, C, D, E, F)


if __name__ == '__main__':
    main()


# Fixed version:
#!/usr/bin/env python3
import sys


def v(a: int, b: int, c: int):
    if a < b:
        a, b = b, a
    if c % a == 0:
        return c
    minr = c
    for va in range(c // a + 1):
        minr = min(minr, (c - va * a) % b)
        if minr == 0:
            break
    return c - minr


def solve(A: int, B: int, C: int, D: int, E: int, F: int):
    ansa = A * 100
    anss = 0
    for w in range(1, F // 100 + 1):
        w2 = v(B, A, w)
        if w != w2:
            continue
        s = min(w2 * E, F - w2 * 100)
        s2 = v(D, C, s)
        a2 = s2 + w2 * 100
        if a2 > F:
            continue
        # anss / ansa < s2 / a2
        if anss * a2 < ansa * s2:
            ansa, anss = a2, s2
    print(ansa, anss)


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    D = int(next(tokens))  # type: int
    E = int(next(tokens))  # type: int
    F = int(next(tokens))  # type: int
    solve(A, B, C, D, E, F)


if __name__ == '__main__':
    main()

# Buggy version:
import itertools
A, B, C, D, E, F = map(int, input().split())
U = F
water = [0]*(U+1)
water[0] = 1
for i in range(U+1):
    if water[i]:
        if i+100*A <= U:
            water[i+100*A] = 1
        if i+100*B <= U:
            water[i+100*B] = 1

water_val = [val for val in range(1, U+1) if water[val]]
print(water_val)

suger = [0]*(U+1)
suger[0] = 1
for i in range(U+1):
    if suger[i]:
        if i+C <= U:
            suger[i+C] = 1
        if i+D <= U:
            suger[i+D] = 1

suger_val = [val for val in range(U+1) if suger[val]]
max_c = -1
for w, s in itertools.product(water_val, suger_val):
    if E*w < 100*s:
        continue
    if F < w+s:
        continue

    if max_c < 100*s/(w+s):
        max_c = 100*s/(w+s)
        ans = (w+s, s)

print(*ans)

# Fixed version:
import itertools
A, B, C, D, E, F = map(int, input().split())
U = F
water = [0]*(U+1)
water[0] = 1
for i in range(U+1):
    if water[i]:
        if i+100*A <= U:
            water[i+100*A] = 1
        if i+100*B <= U:
            water[i+100*B] = 1
water_val = [val for val in range(1, U+1) if water[val]]
suger = [0]*(U+1)
suger[0] = 1
for i in range(U+1):
    if suger[i]:
        if i+C <= U:
            suger[i+C] = 1
        if i+D <= U:
            suger[i+D] = 1

suger_val = [val for val in range(U+1) if suger[val]]
max_c = -1
for w, s in itertools.product(water_val, suger_val):
    if E*w < 100*s:
        continue
    if F < w+s:
        continue

    if max_c < 100*s/(w+s):
        max_c = 100*s/(w+s)
        ans = (w+s, s)

print(*ans)

# Buggy version:
A,B,C,D,E,F = map(int,input().split())
f = F//100

per = 0
#水の量を100g単位ずつ全探索
for w in range(1,f+1):
    #そのような水の取り方があるか確認
    wt = 0
    for b in range(0,w+1,B):
        if (w-b)%A == 0:
            wt = 1
            break
    if wt == 0:
        continue

    water = w*100
    sugar = w*E
    #砂糖として考えられる量を大きい順に0gまでに全探索
    for s in range(sugar,-1,-1):
        そのような砂糖の取り方があるか確認
        st = 0
        for d in range(0,s+1,D):
            if (s-d)%C == 0:
                st = 1
                break
        if st == 1:
            break
    if s+water <= F and s/(s+water) > per:
        ans = [s+water,s]
        per = s/(s+water)

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


# Fixed version:
A,B,C,D,E,F = map(int,input().split())
f = F//100

ans = [0,0]
per = -1
#水の量を100g単位ずつ全探索
for w in range(1,f+1):
    #そのような水の取り方があるか確認
    wt = 0
    for b in range(0,w+1,B):
        if (w-b)%A == 0:
            wt = 1
            break
    if wt == 0:
        continue

    water = w*100
    st = 0
    #砂糖として考えられる量を大きい順に0gまでに全探索
    for s in range(min(w*E,F-water),-1,-1):
        st = 0
        for d in range(0,s+1,D):
            if (s-d)%C == 0:
                st = 1
                break
        if st == 1:
            break

    if s/(s+water) > per:
        ans = [s+water,s]
        per = s/(s+water)

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

# Buggy version:
import itertools
a,b,c,d,e,f = [int(_) for _ in input().split()]

water = []
i = 0
while True:
    j = 0
    if i * 100 * a + j * 100 * b > f:
        break
    while True:
        if i == 0 and j == 0:
            j += 1
            continue
        if i * 100 * a + j * 100 * b > f:
            break
        water.append(i * 100 * a + j * 100 * b)
        j += 1
    i += 1

sugar = []
i = 0
while True:
    j = 0
    if i * c + j * d > f * e // 100:
        break
    while True:
        if i == 0 and j == 0:
            j += 1
            continue
        if i * c + j * d > f * e // 100:
            break
        sugar.append(i * c + j * d)
        j += 1
    i += 1

most_dense = 0
final_total = 0
final_sugar = 0
for i, j in itertools.product(range(0,len(water)), range(0, len(sugar))):
    density = sugar[j] / (water[i] + sugar[j])
    if water[i] + sugar[j] < f and water[i] * e // 100 >= sugar[j] and density >= most_dense:
        most_dense = density
        final_total = water[i]+sugar[j]
        final_sugar = sugar[j]

print(final_total, final_sugar)

# Fixed version:
import itertools
a,b,c,d,e,f = [int(_) for _ in input().split()]

water = []
i = 0
while True:
    j = 0
    if i * 100 * a + j * 100 * b > f:
        break
    while True:
        if i == 0 and j == 0:
            j += 1
            continue
        if i * 100 * a + j * 100 * b > f:
            break
        water.append(i * 100 * a + j * 100 * b)
        j += 1
    i += 1
set_water = sorted(set(water))

sugar = []
i = 0
while True:
    j = 0
    if i * c + j * d > f * e // 100:
        break
    while True:
        if i == 0 and j == 0:
            j += 1
            continue
        if i * c + j * d > f * e // 100:
            break
        sugar.append(i * c + j * d)
        j += 1
    i += 1
set_sugar = sorted(set(sugar))

most_dense = 0
final_total = 0
final_sugar = 0
for i, j in itertools.product(range(0,len(set_water)), range(0, len(set_sugar))):
    density = set_sugar[j] / (set_water[i] + set_sugar[j])
    if density > most_dense and set_water[i] * e // 100 >= set_sugar[j] and set_water[i] + set_sugar[j] <= f:
        most_dense = density
        final_total = set_water[i]+set_sugar[j]
        final_sugar = set_sugar[j]

if final_total == 0:
    final_total = a * 100
print(final_total, final_sugar)

# Buggy version:
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()

lim = 0
for l in L:
    limit = min(F-100*l, E*l)
    if limit > lim:
        lim = limit
        w = 100*l

su = 0
for c in range(3000):
    if C*c >lim:
        break
    d = (lim - C*c) // D
    p = C*c+D*d
    if p > su:
        su = p
print(w+su, su)

# Fixed version:
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)

# Buggy version:
from decilmal import Decimal as D
mi1,mi2,sa1,sa2,houwa,lim=map(int,input().split())
slim=lim*houwa//100
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*100,0
for s in ss:
  for w in ws:
    if s>houwa*w or s==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)


# Fixed version:
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)

# Buggy version:
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((E*w / 100) / C + 1) for d in range((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(W[I] + S[I], S[I])


# Fixed version:
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])

# Buggy version:
A, B, C, D, E, F = list(map(int, input().split()))

sugar = []
water = []

for i in range(31):
    for j in range(31):
        x = 100*A*i+100*B*j
        if x != 0 and x <= F:
            water.append(x)
        y = C*i+D*j
        if y != 0:    
            sugar.append(y)

ans_water_sugar = 0
ans_sugar = 0
conce = 0 

for s in sugar:
    for w in water:
        if w+s <= F:
            if s/w <= E/100:
                if conce < s/w:
                    conce = s/w
                    ans_water_sugar = s+w
                    ans_sugar = s

print(ans_water_sugar, ans_sugar)

# Fixed version:
A, B, C, D, E, F = list(map(int, input().split()))

sugar = []
water = []

for i in range(31):
    for j in range(31):
        x = 100*A*i+100*B*j
        if x != 0 and x <= F:
            water.append(x)
        
n = int(F/(100+E)*E)

for k in range(n):
    for l in range(n):
        y = C*k+D*l
        if y != 0:    
            sugar.append(y)

ans_water_sugar = 100*A
ans_sugar = 0
conce = 0 

for s in list(set(sugar)):
    for w in water:
        if w+s <= F:
            if s/w <= E/100:
                if conce < s/w:
                    conce = s/w
                    ans_water_sugar = s+w
                    ans_sugar = s

print(ans_water_sugar, ans_sugar)

# Buggy version:
A,B,C,D,E,F = map(int,input().split())

waters = set()
wa = 100*A
while wa <= F:
    waters.add(wa)
    wa += 100*A
wb = 100*B
while wb <= F:
    waters.add(wb)
    wb += 100*B

sugars = set()
sc = C
while sc <= F:
    sugars.add(sc)
    sc += C
sd = D
while sd <= F:
    sugars.add(sd)
    sd += D

best = 0.0
best_w = best_s = 0
for w in sorted(waters):
    for s in sorted(sugars):
        if 100*s > w*E: continue
        if w+s > F: continue
        if best < 100*s / (w+s):
            best = 100*s / (w+s)
            best_w = w
            best_s = s
print(best_w+best_s, best_s)

# Fixed version:
A,B,C,D,E,F = map(int,input().split())

waters = set()
for wb in range(0,F+1,100*B):
    wa = 0
    while wa + wb <= F:
        waters.add(wa + wb)
        wa += 100*A
waters.remove(0)

sugars = set()
for sd in range(0,F+1,D):
    sc = 0
    while sc + sd <= F:
        sugars.add(sc + sd)
        sc += C

best = -1
best_w = best_s = 0
for w in sorted(waters):
    for s in sorted(sugars):
        if 100*s > w*E: continue
        if w+s > F: continue
        if best < 100*s / (w+s):
            best = 100*s / (w+s)
            best_w = w
            best_s = s

print(best_w+best_s, best_s)