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

kouho = []

for i in range(f // (100 * a) + 1):

    for j in range(f // (100 * b) + 1):

        water = 100 * (a * i + b * j)

        if water > f:

            break

        if water == 0:

            continue

        sugar_max = (a * i + b * j) * e

        for k in range(sugar_max // c + 1):

            for l in range(sugar_max // d + 1):

                sugar = c * k + d * l

                if water + sugar > f:

                    break

                if sugar > sugar_max:

                    break

                density = (sugar / (water + sugar), water + sugar, sugar)

                kouho.append(density)

kouho.sort(reverse=True)

print((kouho[0][1], kouho[0][2]))

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

kouho = 0

jisho = {}

max_a = 30 // a

max_b = 30 // b

for i in range(max_a + 1):

    for j in range(max_b + 1):

        water = (a * i + b * j) * 100

        if water == 0:

            continue

        lim1 = e * (a * i + b * j)

        lim2 = f - water

        lim = min(lim1, lim2)

        max_c = lim // c

        max_d = lim // d

        for k in range(max_c + 1):

            for m in range(max_d + 1):

                sugar = k * c + m * d

                if sugar > lim:

                    continue

                satoumizu = water + sugar

                if satoumizu > f:

                    continue

                if sugar == 0:

                    continue



                noudo = 100 * sugar / satoumizu

                if noudo > kouho:

                    kouho = noudo

                    jisho[noudo] = (sugar, satoumizu)

if kouho == 0:

    print((100 * a, 0))

    exit()

ans2, ans1 = jisho[kouho]

print((ans1, ans2))

a, b, c, d, e, f = list(map(int, input().split()))
kouho = []
for i in range(f // (100 * a) + 1):
    for j in range(f // (100 * b) + 1):
        water = 100 * (a * i + b * j)
        if water > f:
            break
        if water == 0:
            continue
        sugar_max = (a * i + b * j) * e
        for k in range(sugar_max // c + 1):
            for l in range(sugar_max // d + 1):
                sugar = c * k + d * l
                if water + sugar > f:
                    break
                if sugar > sugar_max:
                    break
                density = (sugar / (water + sugar), water + sugar, sugar)
                kouho.append(density)
kouho.sort(reverse=True)
print((kouho[0][1], kouho[0][2]))

a, b, c, d, e, f = list(map(int, input().split()))
kouho = 0
jisho = {}
max_a = 30 // a
max_b = 30 // b
for i in range(max_a + 1):
    for j in range(max_b + 1):
        water = (a * i + b * j) * 100
        if water == 0:
            continue
        lim1 = e * (a * i + b * j)
        lim2 = f - water
        lim = min(lim1, lim2)
        max_c = lim // c
        max_d = lim // d
        for k in range(max_c + 1):
            for m in range(max_d + 1):
                sugar = k * c + m * d
                if sugar > lim:
                    continue
                satoumizu = water + sugar
                if satoumizu > f:
                    continue
                if sugar == 0:
                    continue
                noudo = 100 * sugar / satoumizu
                if noudo > kouho:
                    kouho = noudo
                    jisho[noudo] = (sugar, satoumizu)
if kouho == 0:
    print((100 * a, 0))
    exit()
ans2, ans1 = jisho[kouho]
print((ans1, ans2))

-kouho = [] -for i in range(f // (100 * a) + 1): -    for j in range(f // (100 * b) + 1): -        water = 100 * (a * i + b * j) -        if water > f: -            break +kouho = 0 +jisho = {} +max_a = 30 // a +max_b = 30 // b +for i in range(max_a + 1): +    for j in range(max_b + 1): +        water = (a * i + b * j) * 100 -        sugar_max = (a * i + b * j) * e -        for k in range(sugar_max // c + 1): -            for l in range(sugar_max // d + 1): -                sugar = c * k + d * l -                if water + sugar > f: -                    break -                if sugar > sugar_max: -                    break -                density = (sugar / (water + sugar), water + sugar, sugar) -                kouho.append(density) -kouho.sort(reverse=True) -print((kouho[0][1], kouho[0][2])) +        lim1 = e * (a * i + b * j) +        lim2 = f - water +        lim = min(lim1, lim2) +        max_c = lim // c +        max_d = lim // d +        for k in range(max_c + 1): +            for m in range(max_d + 1): +                sugar = k * c + m * d +                if sugar > lim: +                    continue +                satoumizu = water + sugar +                if satoumizu > f: +                    continue +                if sugar == 0: +                    continue +                noudo = 100 * sugar / satoumizu +                if noudo > kouho: +                    kouho = noudo +                    jisho[noudo] = (sugar, satoumizu) +if kouho == 0: +    print((100 * a, 0)) +    exit() +ans2, ans1 = jisho[kouho] +print((ans1, ans2))