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

water = set([])



for i in range(1, F // (100 * A) + 1):

    water1 = i * 100 * A

    for j in range((F - water1) // (100 * B) + 1):

        water2 = j * 100 * B

        water.add(water1 + water2)



ans = [100 * A, 0]

c = 0



for i in water:

    max_sugar = min(i // 100 * E, F - i)

    sugar = 0

    for j in range(max_sugar // C + 1):

        for k in range((max_sugar - j * C) // D + 1):

            sugar = max(sugar, j * C + k * D)

    concentration = sugar / (i + sugar)

    if c < concentration:

        c = concentration

        ans = [i + sugar, sugar]



print((' '.join(map(str, ans))))
A, B, C, D, E, F = list(map(int, input().split()))

water = set([])



for i in range(1, F // (100 * A) + 1):

    water1 = i * 100 * A

    for j in range((F - water1) // (100 * B) + 1):

        water2 = j * 100 * B

        water.add(water1 + water2)



ans = [100 * A, 0]

c = 0



for i in water:

    max_sugar = min(i // 100 * E, F - i)

    sugar = 0

    for j in reversed(list(range(max_sugar // C + 1))):

        for k in range((max_sugar - j * C) // D + 1):

            sugar = max(sugar, j * C + k * D)

            if max_sugar == sugar:

                break

        else:

            continue

        break

    concentration = sugar / (i + sugar)

    if c < concentration:

        c = concentration

        ans = [i + sugar, sugar]



print((' '.join(map(str, ans))))
A, B, C, D, E, F = list(map(int, input().split()))
water = set([])
for i in range(1, F // (100 * A) + 1):
    water1 = i * 100 * A
    for j in range((F - water1) // (100 * B) + 1):
        water2 = j * 100 * B
        water.add(water1 + water2)
ans = [100 * A, 0]
c = 0
for i in water:
    max_sugar = min(i // 100 * E, F - i)
    sugar = 0
    for j in range(max_sugar // C + 1):
        for k in range((max_sugar - j * C) // D + 1):
            sugar = max(sugar, j * C + k * D)
    concentration = sugar / (i + sugar)
    if c < concentration:
        c = concentration
        ans = [i + sugar, sugar]
print((" ".join(map(str, ans))))

A, B, C, D, E, F = list(map(int, input().split()))
water = set([])
for i in range(1, F // (100 * A) + 1):
    water1 = i * 100 * A
    for j in range((F - water1) // (100 * B) + 1):
        water2 = j * 100 * B
        water.add(water1 + water2)
ans = [100 * A, 0]
c = 0
for i in water:
    max_sugar = min(i // 100 * E, F - i)
    sugar = 0
    for j in reversed(list(range(max_sugar // C + 1))):
        for k in range((max_sugar - j * C) // D + 1):
            sugar = max(sugar, j * C + k * D)
            if max_sugar == sugar:
                break
        else:
            continue
        break
    concentration = sugar / (i + sugar)
    if c < concentration:
        c = concentration
        ans = [i + sugar, sugar]
print((" ".join(map(str, ans))))

-    for j in range(max_sugar // C + 1): +    for j in reversed(list(range(max_sugar // C + 1))): +            if max_sugar == sugar: +                break +        else: +            continue +        break