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

items = []



for w in range(16):

    for x in range(16):

        if w == x == 0:

            continue

        for y in range(1501):

            a = 100*A*w

            b = 100*B*x

            c = C*y

            i = (F-(a+b+c))//D

            for z in reversed(list(range(i+1))):

                d = D*z

                if a+b+c+d <= F and (a+b)*E >= (c+d)*100:

                    items.append((100*(c+d)/(a+b+c+d), a+b, c+d))

                    break



items.sort(reverse=True)



print((items[0][1]+items[0][2], items[0][2]))

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

items = []

water = list(set([100*(A*w+B*x) for w in range(16)

                  for x in range(16) if A*w+B*x <= 30]))

water.sort()



for w in water:

    for x in range(1501):

        c = C*x

        i = (F-w-c)//D

        for y in reversed(list(range(i+1))):

            d = D*y

            if 0 < w+c+d <= F and w*E >= 100*(c+d):

                items.append((100*(c+d)/(w+c+d), w+c+d, c+d))

                break



items.sort(reverse=True)

print((items[0][1], items[0][2]))
A, B, C, D, E, F = list(map(int, input().split()))
items = []
for w in range(16):
    for x in range(16):
        if w == x == 0:
            continue
        for y in range(1501):
            a = 100 * A * w
            b = 100 * B * x
            c = C * y
            i = (F - (a + b + c)) // D
            for z in reversed(list(range(i + 1))):
                d = D * z
                if a + b + c + d <= F and (a + b) * E >= (c + d) * 100:
                    items.append((100 * (c + d) / (a + b + c + d), a + b, c + d))
                    break
items.sort(reverse=True)
print((items[0][1] + items[0][2], items[0][2]))

A, B, C, D, E, F = list(map(int, input().split()))
items = []
water = list(
    set(
        [
            100 * (A * w + B * x)
            for w in range(16)
            for x in range(16)
            if A * w + B * x <= 30
        ]
    )
)
water.sort()
for w in water:
    for x in range(1501):
        c = C * x
        i = (F - w - c) // D
        for y in reversed(list(range(i + 1))):
            d = D * y
            if 0 < w + c + d <= F and w * E >= 100 * (c + d):
                items.append((100 * (c + d) / (w + c + d), w + c + d, c + d))
                break
items.sort(reverse=True)
print((items[0][1], items[0][2]))

-for w in range(16): -    for x in range(16): -        if w == x == 0: -            continue -        for y in range(1501): -            a = 100 * A * w -            b = 100 * B * x -            c = C * y -            i = (F - (a + b + c)) // D -            for z in reversed(list(range(i + 1))): -                d = D * z -                if a + b + c + d <= F and (a + b) * E >= (c + d) * 100: -                    items.append((100 * (c + d) / (a + b + c + d), a + b, c + d)) -                    break +water = list( +    set( +        [ +            100 * (A * w + B * x) +            for w in range(16) +            for x in range(16) +            if A * w + B * x <= 30 +        ] +    ) +) +water.sort() +for w in water: +    for x in range(1501): +        c = C * x +        i = (F - w - c) // D +        for y in reversed(list(range(i + 1))): +            d = D * y +            if 0 < w + c + d <= F and w * E >= 100 * (c + d): +                items.append((100 * (c + d) / (w + c + d), w + c + d, c + d)) +                break -print((items[0][1] + items[0][2], items[0][2])) +print((items[0][1], items[0][2]))