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



w = set()

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

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

        a = (A * i + B * j) * 100

        if a < F:

            w.add(a)

w.remove(0)



best_concentration = -1

best_a = -1

best_b = -1

for a in w:

    t = min(F - a, E * a // 100)

    for i in range(t // C + 1):

        for j in range(t // D + 1):

            b = C * i + D * j

            if a + b > F:

                continue

            if b > E * a // 100:

                continue

            concentration = 100 * b / (a + b)

            if concentration > best_concentration:

                best_concentration = concentration

                best_a = a

                best_b = b

print((best_a + best_b, best_b))

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



w = set()

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

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

        a = (A * i + B * j) * 100

        if a < F:

            w.add(a)

w.remove(0)



s = set()

t = E * F // 100

for i in range(t // C + 1):

    for j in range(t // D + 1):

        b = C * i + D * j

        if b < t:

            s.add(b)



best_concentration = -1

best_a = -1

best_b = -1

for a in w:

    for b in sorted(s):

        if a + b > F:

            break

        if b > E * a // 100:

            break

        concentration = 100 * b / (a + b)

        if concentration > best_concentration:

            best_concentration = concentration

            best_a = a

            best_b = b

print((best_a + best_b, best_b))

A, B, C, D, E, F = list(map(int, input().split()))
w = set()
for i in range(F // (100 * A) + 1):
    for j in range(F // (100 * B) + 1):
        a = (A * i + B * j) * 100
        if a < F:
            w.add(a)
w.remove(0)
best_concentration = -1
best_a = -1
best_b = -1
for a in w:
    t = min(F - a, E * a // 100)
    for i in range(t // C + 1):
        for j in range(t // D + 1):
            b = C * i + D * j
            if a + b > F:
                continue
            if b > E * a // 100:
                continue
            concentration = 100 * b / (a + b)
            if concentration > best_concentration:
                best_concentration = concentration
                best_a = a
                best_b = b
print((best_a + best_b, best_b))

A, B, C, D, E, F = list(map(int, input().split()))
w = set()
for i in range(F // (100 * A) + 1):
    for j in range(F // (100 * B) + 1):
        a = (A * i + B * j) * 100
        if a < F:
            w.add(a)
w.remove(0)
s = set()
t = E * F // 100
for i in range(t // C + 1):
    for j in range(t // D + 1):
        b = C * i + D * j
        if b < t:
            s.add(b)
best_concentration = -1
best_a = -1
best_b = -1
for a in w:
    for b in sorted(s):
        if a + b > F:
            break
        if b > E * a // 100:
            break
        concentration = 100 * b / (a + b)
        if concentration > best_concentration:
            best_concentration = concentration
            best_a = a
            best_b = b
print((best_a + best_b, best_b))

+s = set() +t = E * F // 100 +for i in range(t // C + 1): +    for j in range(t // D + 1): +        b = C * i + D * j +        if b < t: +            s.add(b) -    t = min(F - a, E * a // 100) -    for i in range(t // C + 1): -        for j in range(t // D + 1): -            b = C * i + D * j -            if a + b > F: -                continue -            if b > E * a // 100: -                continue -            concentration = 100 * b / (a + b) -            if concentration > best_concentration: -                best_concentration = concentration -                best_a = a -                best_b = b +    for b in sorted(s): +        if a + b > F: +            break +        if b > E * a // 100: +            break +        concentration = 100 * b / (a + b) +        if concentration > best_concentration: +            best_concentration = concentration +            best_a = a +            best_b = b