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



best = -1.0

a = ws = sg = 0



while 100 * a * A <= F:

    b = 0

    while True:

        w = 100 * (a * A + b * B)

        if w > F: break

        c = 0

        while w + c * C <= F and 100 * c * C <= w * E:

            d = 0

            while True:

                s = c * C + d * D

                if w + s > F or 100 * s > w * E:

                    break

                elif w + s != 0 and best < s / (w + s):

                    best = s / (w + s)

                    ws = w + s

                    sg = s

                d += 1

            c += 1

        b += 1

    a += 1

print((ws, sg))
A, B, C, D, E, F = list(map(int, input().split()))



best = -1.0

ws = sg = 0



for a in range(0, F + 1, 100 * A):

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

        w = a + b

        m = min(F - w, w * E // 100)



        if w == 0: continue

        for c in range(0, m + 1, C):

            for d in range(0, m - c + 1, D):

                s = c + d

                if best < s / (w + s):

                    best = s / (w + s)

                    ws = w + s

                    sg = s

print((ws, sg))
A, B, C, D, E, F = list(map(int, input().split()))
best = -1.0
a = ws = sg = 0
while 100 * a * A <= F:
    b = 0
    while True:
        w = 100 * (a * A + b * B)
        if w > F:
            break
        c = 0
        while w + c * C <= F and 100 * c * C <= w * E:
            d = 0
            while True:
                s = c * C + d * D
                if w + s > F or 100 * s > w * E:
                    break
                elif w + s != 0 and best < s / (w + s):
                    best = s / (w + s)
                    ws = w + s
                    sg = s
                d += 1
            c += 1
        b += 1
    a += 1
print((ws, sg))

A, B, C, D, E, F = list(map(int, input().split()))
best = -1.0
ws = sg = 0
for a in range(0, F + 1, 100 * A):
    for b in range(0, F - a + 1, 100 * B):
        w = a + b
        m = min(F - w, w * E // 100)
        if w == 0:
            continue
        for c in range(0, m + 1, C):
            for d in range(0, m - c + 1, D):
                s = c + d
                if best < s / (w + s):
                    best = s / (w + s)
                    ws = w + s
                    sg = s
print((ws, sg))

-a = ws = sg = 0 -while 100 * a * A <= F: -    b = 0 -    while True: -        w = 100 * (a * A + b * B) -        if w > F: -            break -        c = 0 -        while w + c * C <= F and 100 * c * C <= w * E: -            d = 0 -            while True: -                s = c * C + d * D -                if w + s > F or 100 * s > w * E: -                    break -                elif w + s != 0 and best < s / (w + s): +ws = sg = 0 +for a in range(0, F + 1, 100 * A): +    for b in range(0, F - a + 1, 100 * B): +        w = a + b +        m = min(F - w, w * E // 100) +        if w == 0: +            continue +        for c in range(0, m + 1, C): +            for d in range(0, m - c + 1, D): +                s = c + d +                if best < s / (w + s): -                d += 1 -            c += 1 -        b += 1 -    a += 1