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.
[{"code": "a, b, c, d, e, f = map(int, input().split())\ns = set()\nfor i in range(30 // a + 1):\n    for j in range(30 // b + 1):\n        if 0 < (a * i + b * j) * 100 <= f:\n            s = s | {a * i + b * j}\ns2 = set()\nfor i in range(3000 // c + 1):\n    for j in range(3000 // d + 1):\n        if c * i + d * j <= f:\n            s2 = s2 | {c * i + d * j}\nans = []\nfor i in s:\n    for j in s2:\n        if i * 100 + j <= f and j <= i * e:\n            ans.append([j / i * -1, i * 100 + j, j])\nans.sort()\nprint(ans[0][1], ans[0][2])", "passed": true, "time": 1.53, "memory": 14072.0, "status": "done"}, {"code": "A,B,C,D,E,F = map(int,input().split())\n\nconcentration = 0\nans = [A*100,0]\n\nwater = []\nfor a in range(F//(A*100) + 1):\n  for b in range(((F-a*A*100)//(B*100))+1):\n    water.append((a*A+b*B)*100)\n    \nwater = sorted(list(set(water)))\n\nsugar = []\nfor c in range(F//C + 1):\n  for d in range(((F - c*C)//D)+1):\n    sugar.append(c*C+d*D)\nsugar = sorted(list(set(sugar)))\n\n\nfor wa in water:\n  for su in sugar:\n    if wa + su <= F:\n      if su <= (wa/100)*E:\n        if wa != 0:\n          if concentration < su/(su+wa):\n            concentration = su/(su+wa)\n            ans = [su+wa,su]\n\nprint(\" \".join(map(str,ans)))", "passed": true, "time": 0.17, "memory": 22428.0, "status": "done"}, {"code": "A,B,C,D,E,F = map(int,input().split())\nmx =- 1\nS = set()\nW = set()\n\nfor a in range(0,F+1,100*A):\n  for b in range(0,F+1-a,100*B):\n    W.add(a+b)\n\nfor c in range(0,F+1,C):\n  for d in range(0,F+1-c,D):\n    S.add(c+d)\n\nfor w in W:\n  for s in S:\n    if 0<w+s<=F and s<=w*E//100:\n      if mx<s/(w+s):\n        ans=w+s,s\n        mx=s/(w+s)\n\nprint(ans[0],ans[1])", "passed": true, "time": 0.2, "memory": 14204.0, "status": "done"}, {"code": "a,b,c,d,e,f=map(int,input().split())\nw=set()\nfor i in range(0,f,100*a):\n    for j in range(0,f,100*b):\n        if i+j<=f:\n            w.add(i+j)\n        else:\n            break\ns=set()\nfor i in range(0,f,c):\n    for j in range(0,f,d):\n        if i+j<=f:\n            s.add(i+j)\n        else:\n            break\nn=100*a\nm=0\nl=0\nfor x in w:\n    for t in s:\n        if x+t!=0 and x+t<=f and 100*t<=e*x and t/(x+t)>l:\n            n=x+t\n            m=t\n            l=t/(x+t)\nprint(n,m)", "passed": true, "time": 0.33, "memory": 14228.0, "status": "done"}, {"code": "A,B,C,D,E,F = map(int,input().split())\nmx =- 1\nS = set()\nW = set()\n\nfor a in range(0,F+1,100*A):\n  for b in range(0,F+1-a,100*B):\n    W.add(a+b)\n\nfor c in range(0,F+1,C):\n  for d in range(0,F+1-c,D):\n    S.add(c+d)\n\nfor w in W:\n  for s in S:\n    if 0<w+s<=F and s<=w*E//100:\n      if mx<s/(w+s):\n        ans=w+s,s\n        mx=s/(w+s)\n\nprint(ans[0],ans[1])", "passed": true, "time": 0.18, "memory": 14144.0, "status": "done"}, {"code": "a, b, c, d, e, f = map(int, input().split())\n\nwater = [False] * (f//100 + 1)\nfor i in range(0, len(water), a):\n    water[i] = True\nfor i in range(len(water) - b):\n    if water[i]:\n        water[i + b] = True\n\nsugar = [False] * ((f//100) * e + 1)\nfor i in range(0, len(sugar), c):\n    sugar[i] = True\nfor i in range(len(sugar) - d):\n    if sugar[i]:\n        sugar[i + d] = True\n\n# denominator: \u5206\u6bcd, numerator: \u5206\u5b50\ndeno = a * 100\nnume = 0\n\nfor i in range(1, len(water)):\n    if water[i]:\n        j = min([i*e, f - 100*i])\n        while not sugar[j]:\n            j -= 1\n        i = 100 * i + j\n\n        if nume * i < deno * j:\n            deno = i\n            nume = j\n\nprint(deno, nume)", "passed": true, "time": 0.23, "memory": 14164.0, "status": "done"}, {"code": "a, b, c, d, e, f = map(int, input().split())\nW = set(); S = set()\nsa = 0; wsa = a * 100\nfor i in range(0, f + a * 100, a * 100):\n    for j in range(0, f + b * 100, b * 100):\n        w = i + j\n        if w <= f:\n            W.add(w)\n        else:\n            break\nfor i in range(0, f // 2 + c, c):\n    for j in range(0, f // 2 + d, d):\n        s = i + j\n        if s <= f // 2:\n            S.add(s)\n        else:\n            break\nS.remove(0)\nfor i in W:\n    for j in S:\n        if e / (100 + e) >= j / (i + j) > sa / wsa and i + j <= f:\n            sa, wsa = j, i + j\nprint(wsa, sa)", "passed": true, "time": 0.26, "memory": 14292.0, "status": "done"}, {"code": "import bisect, heapq\n\na, b, c, d, e, f = map(int, input().split())\n\nw = set()\ntemp = [a * i for i in range((30 - 1) // a + 2)]\nfor i in temp:\n    while i not in w and i <= 30:\n        w.add(i)\n        i += b\nw = list(w)\nw.remove(0)\nw.sort()\n\ns = set()\ntemp = [c * i for i in range((3000 - 1) // c + 2)]\nfor i in temp:\n    while i not in s and i <= 3000:\n        s.add(i)\n        i += d\ns = list(s)\ns.sort()\n\nqueue = []\nheapq.heapify(queue)\nfor i in w:\n    if i * 100 > f:\n        continue\n    num = bisect.bisect(s, i * e)\n    for j in range(num - 1, -1, -1):\n        if i * 100 + s[j] > f:\n            continue\n        heapq.heappush(queue, [-s[j] / i, 100 * i + s[j], s[j]])\n        break\nprint(queue[0][1], queue[0][2])", "passed": true, "time": 0.14, "memory": 14140.0, "status": "done"}, {"code": "a, b, c, d, e, f = map(int, input().split())\n\nans = -1\nans_water = -1\nans_sugar = -1\nfor ia in range(f//(a*100)+2):\n    water = 100*a*ia\n    if water > f or water == 0: continue\n    for ib in range(f//(b*100)+2):\n        if ib != 0: water += 100*b\n        if water > f or water == 0: continue\n        for ic in range(f//c+1):\n            sugar = c*ic\n            if sugar/(water//100) > e: continue\n            for id in range(f//d+1):\n                if id != 0: sugar+=d\n                if sugar/(water//100) > e: continue\n                if sugar + water > f: continue\n                if (100*sugar)/(sugar+water) > ans:\n                    ans = (100*sugar)/(sugar+water)\n                    ans_water = water\n                    ans_sugar = sugar\nprint(ans_sugar+ans_water, ans_sugar)", "passed": true, "time": 1.45, "memory": 14212.0, "status": "done"}, {"code": "a,b,c,d,e,f=map(int,input().split())\nans=[-1]*9999\nans[a*100]=0\nans[b*100]=0\nfin=[a*100,0]\np=0\nfor i in range(1,f+1):\n    if ans[i]==-1:\n        continue\n    if (ans[i]+c)/(i-ans[i])<=e*0.01:\n        ans[i+c]=max(ans[i]+c,ans[i+c])\n    if (ans[i]+d)/(i-ans[i])<=e*0.01:\n        ans[i+d]=max(ans[i]+d,ans[i+d])\n    ans[i+a*100]=max(ans[i+a*100],ans[i])\n    ans[i+b*100]=max(ans[i+b*100],ans[i])\n    if ans[i]/i>p:\n        p=ans[i]/i\n        fin=[i,ans[i]]\nprint(*fin)", "passed": true, "time": 0.14, "memory": 14356.0, "status": "done"}, {"code": "a,b,c,d,e,f = map(int,input().split())\nans = [-1]*10000\n# ans[0] = 0\nans[a*100] = 0\nans[b*100] = 0\nq1 = a*100\nq2 = b*100\np = 0\nfin = [a*100,0]\nfor i in range(1,f+1):\n    if ans[i] == -1:\n        continue\n    if (ans[i]+c)/(i-ans[i]) <= e*0.01:\n        ans[i+c] = max(ans[i]+c,ans[i+c])\n    if (ans[i]+d)/(i-ans[i]) <= e*0.01:\n        ans[i+d] = max(ans[i]+d,ans[i+d])\n    ans[i+a*100] = max(ans[i+a*100],ans[i])\n    ans[i+b*100] = max(ans[i+b*100],ans[i])\n    if i != 0:\n        if ans[i]/i > p:\n            # print(p,i)\n            p = ans[i]/i\n            fin = [i,ans[i]]\n# print(ans[190:210])\nprint(*fin)", "passed": true, "time": 0.14, "memory": 14184.0, "status": "done"}, {"code": "A,B,C,D,E,F = (int(T) for T in input().split())\nSugM = 0\nWatM = 100*A\nfor TC in range(0,F+1):\n    for TD in range(0,F+1):\n        Suger = C*TC+D*TD\n        RestS = F-Suger\n        if RestS>=0:\n            for TA in range(0,(RestS//100)+1):\n                for TB in range(0,(RestS//100)+1):\n                    if TA==TB==0:\n                        continue\n                    else:\n                        Water = TA*A*100+TB*B*100\n                        RestW = RestS-Water\n                        if RestW>=0 and Water>=(100*Suger)/E:\n                            if SugM/(WatM+SugM)<Suger/(Water+Suger):\n                                SugM = Suger\n                                WatM = Water\n                        else:\n                            break\n        else:\n            break\nprint('{} {}'.format(WatM+SugM,SugM))", "passed": true, "time": 0.77, "memory": 14280.0, "status": "done"}, {"code": "a,b,c,d,e,f=map(int,input().split())\n\nmax_s=0\nmax_w=a\nmax_conc=0\n\nwater_s=set()\nsugar_s=set()\nfor i in range(f//a//100+1):\n  aa=a*i\n  for j in range(f//b//100+1):\n    bb=b*j\n    if aa+bb <= f//100:\n      water_s.add(aa+bb)\n      \nfor i in range(f//c+1):\n  cc=c*i\n  for j in range(f//d+1):\n    dd=d*j\n    if cc+dd <= f:\n      sugar_s.add(cc+dd)\n\nfor w in water_s:\n  for sg in sugar_s:\n    if w*100+sg <= f and w*e >= sg and w+sg > 0:\n      conc=(100*sg)/(100*w+sg)\n      if max_conc < conc:\n        max_conc=conc\n        max_w=w\n        max_s=sg\nprint(max_w*100+max_s,max_s)", "passed": true, "time": 0.19, "memory": 14124.0, "status": "done"}, {"code": "a,b,c,d,e,f=map(int,input().split())\ng=[-1]*9999\ng[a*100]=0\ng[b*100]=0\nh=[a*100,0]\np=0\nfor i in range(1,f+1):\n    if g[i]==-1:\n        continue\n    if (g[i]+c)/(i-g[i])<=e*0.01:\n        g[i+c]=max(g[i]+c,g[i+c])\n    if (g[i]+d)/(i-g[i])<=e*0.01:\n        g[i+d]=max(g[i]+d,g[i+d])\n    g[i+a*100]=max(g[i+a*100],g[i])\n    g[i+b*100]=max(g[i+b*100],g[i])\n    if g[i]/i>p:\n        p=g[i]/i\n        h=[i,g[i]]\nprint(*h)", "passed": true, "time": 0.14, "memory": 14144.0, "status": "done"}, {"code": "a , b , c , d , e , f = map(int,input().split())\nmidp = [-1 for i in range(f+1)]\nmizu = []\nmidp[0] = 0\nfor i in range(f+1):\n    if midp[i] != -1:\n        if i + a*100 <= f and midp[i+a*100] != 0:\n            midp[i+a*100] = 0\n            mizu.append(i+a*100)\n        if i + b*100 <= f and midp[i+b*100] != 0:\n            midp[i+b*100] = 0\n            mizu.append(i+b*100)\nans = 0\ncou = [a*100,0]\nfor i in mizu:\n    sai = i*e//100\n    sadp = [-1 for f in range(sai+1)]\n    sadp[0] = 0\n    maxsa = 0\n    for j in range(sai+1):\n        if sadp[j] != -1:\n            if j + c <= sai and i + j + c <= f and sadp[j+c] != 0:\n                sadp[j+c] = 0\n                maxsa = max(maxsa,j+c)\n            if j + d <= sai and i + j + d <= f and sadp[j+d] != 0:\n                sadp[j+d] = 0\n                maxsa = max(maxsa,j+d)\n    if ans < maxsa/(i+maxsa):\n        ans = maxsa/(i+maxsa)\n        cou = [i+maxsa,maxsa]\n\nprint(*cou)", "passed": true, "time": 0.2, "memory": 14236.0, "status": "done"}, {"code": "A,B,C,D,E,F = map(int,input().split())\n\nws = set()\nfor a in range(0,F+1,100*A):\n    for b in range(0,F+1,100*B):\n        if a+b > F: break\n        ws.add(a+b)\nws.remove(0)\n\nss = set()\nfor c in range(0,F+1,C):\n    for d in range(0,F+1,D):\n        if c+d > F: break\n        ss.add(c+d)\n\nbest_s = -1\nbest_w = 1\nfor w in ws:\n    for s in ss:\n        if w+s > F: continue\n        if E*w < s*100: continue\n        if best_s * (s+w) < s * (best_s + best_w):\n            best_s = s\n            best_w = w\nprint(best_s+best_w, best_s)", "passed": true, "time": 0.17, "memory": 14376.0, "status": "done"}, {"code": "a, b, c, d, e, f = map(int, input().split())\nW = set(); S = set()\nsa = 0; wsa = a * 100\n\nfor i in range(0, f + a * 100, a * 100):\n    for j in range(0, f + b * 100, b * 100):\n        w = i + j\n        if w <= f:\n            W.add(w)\n        else:\n            break\nfor i in range(0, f // 2 + c, c):\n    for j in range(0, f // 2 + d, d):\n        s = i + j\n        if s <= f // 2:\n            S.add(s)\n        else:\n            break\nS.remove(0)\nfor i in W:\n    for j in S:\n        if e / (100 + e) >= j / (i + j) > sa / wsa and i + j <= f:\n            sa, wsa = j, i + j\nprint(wsa, sa)", "passed": true, "time": 0.15, "memory": 14160.0, "status": "done"}, {"code": "a,b,c,d,e,f=map(int,input().split())\na=100*a\nb=100*b\ndp1=[0]*(f+1)\ndp2=[0]*(f+1)\nfor i in range(f+1):\n    if i%a==0:\n        if i+a<=f:\n            dp1[i+a]=1\nfor i in range(f+1):\n    if i==0 or dp1[i]==1:\n        if i+b<=f:\n            dp1[i+b]=1\nfor i in range(f+1):\n    if i%c==0:\n        if i+c<=f:\n            dp2[i+c]=1\nfor i in range(f+1):\n    if i==0 or dp2[i]==1:\n        if i+d<=f:\n            dp2[i+d]=1\n\nans=[-1,-1,-1]\nfor i in range(f+1):\n    if dp1[i]==1:\n        x=min(f-i,(i//100)*e)\n        k=-1\n        for j in range(x,-1,-1):\n            if dp2[j]==1 or j==0:\n                k=j\n                if ans[0]<100*k/(i+k):\n                    ans=[100*k/(i+k),i+k,k]\n                break\nprint(str(ans[1])+\" \"+str(ans[2]))", "passed": true, "time": 0.14, "memory": 14196.0, "status": "done"}, {"code": "import sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n    A, B, C, D, E, F = list(map(int, input().split()))\n\n    max_concentration = 0\n    ans = (100 * A, 0)\n    for a in range(0, F + 1, 100 * A):\n        for b in range(0, F - a + 1, 100 * B):\n            water = a + b\n            if water == 0:\n                break\n            for c in range(0, F - water + 1, C):\n                for d in range(0, F - water - c + 1, D):\n                    sugar = c + d\n                    if sugar > (water // 100) * E:\n                        break\n                    concentration = (100 * sugar) / (water + sugar)\n                    if concentration > max_concentration:\n                        max_concentration = concentration\n                        ans = (water + sugar, sugar)\n\n    print((\" \".join(map(str, ans))))\n\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.26, "memory": 14080.0, "status": "done"}, {"code": "A,B,C,D,E,F=map(int,input().split(' '))\nwater = set()\nfor a in range(0,F,100*A):\n  for b in range(0,F,100*B):\n    if a+b <= F:\n      water.add(a+b)\n    else:\n      break\nsugars = set()\nfor c in range(0,F,C):\n  for d in range(0,F,D):\n    if c+d <= F:\n      sugars.add(c+d)\n    else:\n      break\ndensity = 0\nsugar = 0\ncontent = 100*A\nfor x in water:\n  for y in sugars:\n    if x+y != 0 and x+y <= F and E*x >= 100*y and density < y/(x+y):\n      density = y/(x+y)\n      sugar = y\n      content = x+y\nprint(content,sugar)", "passed": true, "time": 0.22, "memory": 14356.0, "status": "done"}, {"code": "def main():\n\tA, B, C, D, E, F = map(int, input().split())\n\twater = set()\n\tsugar = set()\n\n\tfor i in range(F // (100 * A) + 1):\n\t\tfor j in range(F // (100 * B) + 1):\n\t\t\twater_amount = 100 * A * i + 100 * B * j\n\t\t\tif 0 < water_amount and water_amount <= F:\n\t\t\t\twater.add(water_amount)\n\n\tfor i in range(F // C + 1):\n\t\tfor j in range(F // D + 1):\n\t\t\tsugar_amount = C * i + D * j\n\t\t\tif sugar_amount <= F:\n\t\t\t\tsugar.add(sugar_amount)\n\n\t# print(water)\n\t# print(sugar)\n\n\tmax_c = -1\n\tmax_w = 0\n\tmax_s = 0\n\n\tfor w in water:\n\t\tfor s in sugar:\n\t\t\tif w + s <= F:\n\t\t\t\tif s / w <= E / 100:\n\t\t\t\t\tif s * 100 / (w + s) > max_c:\n\t\t\t\t\t\tmax_c = s * 100 / (w + s)\n\t\t\t\t\t\tmax_w = w\n\t\t\t\t\t\tmax_s = s\n\n\tprint(max_w + max_s, max_s)\n\n \ndef __starting_point():\n  \tmain()\n__starting_point()", "passed": true, "time": 0.2, "memory": 14076.0, "status": "done"}]