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



maxVal = 0

ans = (100 * A, 0)

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

    for bWater in range(0, F + 1, B * 100):

        sumWater = aWater + bWater

        if sumWater == 0 or sumWater > F:

            continue

        maxSuger = sumWater * E // 100

        for cSuger in range(0, maxSuger + 1, C):

            for dSuger in range(0, maxSuger + 1, D):

                sumSuger = cSuger + dSuger

                if sumSuger + sumWater > F or sumSuger > maxSuger:

                    break

                if maxVal < sumSuger / (sumSuger + sumWater):

                    maxVal = sumSuger / (sumSuger + sumWater)

                    ans = (sumSuger + sumWater, sumSuger)



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

A *= 100

B *= 100



dp = [-1] * (F + 1)  # dp[f] = sugar

dp[0] = 0



for f in range(F + 1):

    if A + f <= F:

        dp[A + f] = max(dp[A + f], dp[f])

    if B + f <= F:

        dp[B + f] = max(dp[B + f], dp[f])

    if C + f <= F and dp[f] >= 0:

        water = f - dp[f]

        maxSugar = (water // 100) * E

        if dp[f] + C <= maxSugar:

            dp[C + f] = max(dp[C + f], dp[f] + C)

    if D + f <= F and dp[f] >= 0:

        water = f - dp[f]

        maxSugar = (water // 100) * E

        if dp[f] + D <= maxSugar:

            dp[D + f] = max(dp[D + f], dp[f] + D)



ans = (0, 0)

mx = -1

for f in range(1, F + 1):

    if mx < 100 * dp[f] / f:

        mx = 100 * dp[f] / f

        ans = (f, dp[f])

print((*ans))

A, B, C, D, E, F = list(map(int, input().split()))
maxVal = 0
ans = (100 * A, 0)
for aWater in range(0, F + 1, A * 100):
    for bWater in range(0, F + 1, B * 100):
        sumWater = aWater + bWater
        if sumWater == 0 or sumWater > F:
            continue
        maxSuger = sumWater * E // 100
        for cSuger in range(0, maxSuger + 1, C):
            for dSuger in range(0, maxSuger + 1, D):
                sumSuger = cSuger + dSuger
                if sumSuger + sumWater > F or sumSuger > maxSuger:
                    break
                if maxVal < sumSuger / (sumSuger + sumWater):
                    maxVal = sumSuger / (sumSuger + sumWater)
                    ans = (sumSuger + sumWater, sumSuger)
print((*ans))

A, B, C, D, E, F = list(map(int, input().split()))
A *= 100
B *= 100
dp = [-1] * (F + 1)  # dp[f] = sugar
dp[0] = 0
for f in range(F + 1):
    if A + f <= F:
        dp[A + f] = max(dp[A + f], dp[f])
    if B + f <= F:
        dp[B + f] = max(dp[B + f], dp[f])
    if C + f <= F and dp[f] >= 0:
        water = f - dp[f]
        maxSugar = (water // 100) * E
        if dp[f] + C <= maxSugar:
            dp[C + f] = max(dp[C + f], dp[f] + C)
    if D + f <= F and dp[f] >= 0:
        water = f - dp[f]
        maxSugar = (water // 100) * E
        if dp[f] + D <= maxSugar:
            dp[D + f] = max(dp[D + f], dp[f] + D)
ans = (0, 0)
mx = -1
for f in range(1, F + 1):
    if mx < 100 * dp[f] / f:
        mx = 100 * dp[f] / f
        ans = (f, dp[f])
print((*ans))

-maxVal = 0 -ans = (100 * A, 0) -for aWater in range(0, F + 1, A * 100): -    for bWater in range(0, F + 1, B * 100): -        sumWater = aWater + bWater -        if sumWater == 0 or sumWater > F: -            continue -        maxSuger = sumWater * E // 100 -        for cSuger in range(0, maxSuger + 1, C): -            for dSuger in range(0, maxSuger + 1, D): -                sumSuger = cSuger + dSuger -                if sumSuger + sumWater > F or sumSuger > maxSuger: -                    break -                if maxVal < sumSuger / (sumSuger + sumWater): -                    maxVal = sumSuger / (sumSuger + sumWater) -                    ans = (sumSuger + sumWater, sumSuger) +A *= 100 +B *= 100 +dp = [-1] * (F + 1)  # dp[f] = sugar +dp[0] = 0 +for f in range(F + 1): +    if A + f <= F: +        dp[A + f] = max(dp[A + f], dp[f]) +    if B + f <= F: +        dp[B + f] = max(dp[B + f], dp[f]) +    if C + f <= F and dp[f] >= 0: +        water = f - dp[f] +        maxSugar = (water // 100) * E +        if dp[f] + C <= maxSugar: +            dp[C + f] = max(dp[C + f], dp[f] + C) +    if D + f <= F and dp[f] >= 0: +        water = f - dp[f] +        maxSugar = (water // 100) * E +        if dp[f] + D <= maxSugar: +            dp[D + f] = max(dp[D + f], dp[f] + D) +ans = (0, 0) +mx = -1 +for f in range(1, F + 1): +    if mx < 100 * dp[f] / f: +        mx = 100 * dp[f] / f +        ans = (f, dp[f])