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



total = 0

sugar = 0

max_concentration = 0



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

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

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

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

                if 0 < 100*(a*i+b*j)+(c*k+d*l)<=f and c*k+d*l<=e*(a*i+b*j):

                    if max_concentration <= (c*k+d*l)/(100*(a*i+b*j)+(c*k+d*l)):

                        max_concentration = (c*k+d*l)/(100*(a*i+b*j)+(c*k+d*l))

                        total = 100*(a*i+b*j)+(c*k+d*l)

                        sugar = (c*k+d*l)

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



water = [0 for _ in range(30 + 1)]

sugar = [0 for _ in range(3000 + 1)]



water[0] = 1

sugar[0] = 1



for i in range(30):

    if water[i]:

        if i + A <= 30:

            water[i + A] = 1

        if i + B <= 30:

            water[i + B] = 1



for j in range(3000):

    if sugar[j]:

        if j + C <= 3000:

            sugar[j + C] = 1

        if j + D <= 3000:

            sugar[j + D] = 1



concentration = 0

ans = (100 * A, 0)



for i in range(31):

    if not water[i]:

        continue

    for j in range(3001):

        if not sugar[j]:

            continue

        if i + j == 0 or 100 * i + j > F or j > E * i:

            continue

        if concentration * (100 * i + j) < 100 * j:

            concentration = (100 * j) / (100 * i + j)

            ans = (100 * i + j, j)



print((*ans))
a, b, c, d, e, f = list(map(int, input().split()))
total = 0
sugar = 0
max_concentration = 0
for i in range(f // (100 * a) + 1):
    for j in range(f // (100 * b) + 1):
        for k in range(f // c + 1):
            for l in range(f // d + 1):
                if 0 < 100 * (a * i + b * j) + (
                    c * k + d * l
                ) <= f and c * k + d * l <= e * (a * i + b * j):
                    if max_concentration <= (c * k + d * l) / (
                        100 * (a * i + b * j) + (c * k + d * l)
                    ):
                        max_concentration = (c * k + d * l) / (
                            100 * (a * i + b * j) + (c * k + d * l)
                        )
                        total = 100 * (a * i + b * j) + (c * k + d * l)
                        sugar = c * k + d * l
print((total, sugar))

A, B, C, D, E, F = list(map(int, input().split()))
water = [0 for _ in range(30 + 1)]
sugar = [0 for _ in range(3000 + 1)]
water[0] = 1
sugar[0] = 1
for i in range(30):
    if water[i]:
        if i + A <= 30:
            water[i + A] = 1
        if i + B <= 30:
            water[i + B] = 1
for j in range(3000):
    if sugar[j]:
        if j + C <= 3000:
            sugar[j + C] = 1
        if j + D <= 3000:
            sugar[j + D] = 1
concentration = 0
ans = (100 * A, 0)
for i in range(31):
    if not water[i]:
        continue
    for j in range(3001):
        if not sugar[j]:
            continue
        if i + j == 0 or 100 * i + j > F or j > E * i:
            continue
        if concentration * (100 * i + j) < 100 * j:
            concentration = (100 * j) / (100 * i + j)
            ans = (100 * i + j, j)
print((*ans))

-a, b, c, d, e, f = list(map(int, input().split())) -total = 0 -sugar = 0 -max_concentration = 0 -for i in range(f // (100 * a) + 1): -    for j in range(f // (100 * b) + 1): -        for k in range(f // c + 1): -            for l in range(f // d + 1): -                if 0 < 100 * (a * i + b * j) + ( -                    c * k + d * l -                ) <= f and c * k + d * l <= e * (a * i + b * j): -                    if max_concentration <= (c * k + d * l) / ( -                        100 * (a * i + b * j) + (c * k + d * l) -                    ): -                        max_concentration = (c * k + d * l) / ( -                            100 * (a * i + b * j) + (c * k + d * l) -                        ) -                        total = 100 * (a * i + b * j) + (c * k + d * l) -                        sugar = c * k + d * l -print((total, sugar)) +A, B, C, D, E, F = list(map(int, input().split())) +water = [0 for _ in range(30 + 1)] +sugar = [0 for _ in range(3000 + 1)] +water[0] = 1 +sugar[0] = 1 +for i in range(30): +    if water[i]: +        if i + A <= 30: +            water[i + A] = 1 +        if i + B <= 30: +            water[i + B] = 1 +for j in range(3000): +    if sugar[j]: +        if j + C <= 3000: +            sugar[j + C] = 1 +        if j + D <= 3000: +            sugar[j + D] = 1 +concentration = 0 +ans = (100 * A, 0) +for i in range(31): +    if not water[i]: +        continue +    for j in range(3001): +        if not sugar[j]: +            continue +        if i + j == 0 or 100 * i + j > F or j > E * i: +            continue +        if concentration * (100 * i + j) < 100 * j: +            concentration = (100 * j) / (100 * i + j) +            ans = (100 * i + j, j) +print((*ans))