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

A,B = 100*A,100*B

def ql():

    ans = (0,A)

    for a in range(0,F,A):

        for b in range(0,F,B):

            for c in range(0,F,C):

                for d in range(0,F,D):

                    wat,sug = (a + b),(c + d)

                    if wat+sug > F or 100*sug > E*wat:

                        break

                    elif sug*ans[1] > ans[0]*wat:

                        ans = (sug,wat)  

    return ans

ans = ql()

print(("{} {}".format(sum(ans),ans[0])))
A,B,C,D,E,F = list(map(int,input().split()))

def FS():

    ans = (100*A,0)

    for a in range(0,F,100*A):

        for b in range(0,F,100*B):

            for c in range(0,F,C):

                for d in range(0,F,D):

                    wat,sug = (a + b),(c + d)

                    if wat == 0 or wat+sug > F or 100*sug > E*wat:

                        break

                    elif 100*sug == E*wat:

                        return (wat,sug)

                    elif sug*ans[0] > ans[1]*wat:

                        ans = (wat,sug)  

    return ans

ans = FS()

print((sum(ans),ans[1]))
A, B, C, D, E, F = list(map(int, input().split()))
A, B = 100 * A, 100 * B


def ql():
    ans = (0, A)
    for a in range(0, F, A):
        for b in range(0, F, B):
            for c in range(0, F, C):
                for d in range(0, F, D):
                    wat, sug = (a + b), (c + d)
                    if wat + sug > F or 100 * sug > E * wat:
                        break
                    elif sug * ans[1] > ans[0] * wat:
                        ans = (sug, wat)
    return ans


ans = ql()
print(("{} {}".format(sum(ans), ans[0])))

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


def FS():
    ans = (100 * A, 0)
    for a in range(0, F, 100 * A):
        for b in range(0, F, 100 * B):
            for c in range(0, F, C):
                for d in range(0, F, D):
                    wat, sug = (a + b), (c + d)
                    if wat == 0 or wat + sug > F or 100 * sug > E * wat:
                        break
                    elif 100 * sug == E * wat:
                        return (wat, sug)
                    elif sug * ans[0] > ans[1] * wat:
                        ans = (wat, sug)
    return ans


ans = FS()
print((sum(ans), ans[1]))

-A, B = 100 * A, 100 * B -def ql(): -    ans = (0, A) -    for a in range(0, F, A): -        for b in range(0, F, B): +def FS(): +    ans = (100 * A, 0) +    for a in range(0, F, 100 * A): +        for b in range(0, F, 100 * B): -                    if wat + sug > F or 100 * sug > E * wat: +                    if wat == 0 or wat + sug > F or 100 * sug > E * wat: -                    elif sug * ans[1] > ans[0] * wat: -                        ans = (sug, wat) +                    elif 100 * sug == E * wat: +                        return (wat, sug) +                    elif sug * ans[0] > ans[1] * wat: +                        ans = (wat, sug) -ans = ql() -print(("{} {}".format(sum(ans), ans[0]))) +ans = FS() +print((sum(ans), ans[1]))