Buggy python submission (verdict: Runtime Error):
A, B, C, D, E, F = map(int, input().split())

mx = -s
ans = 0, 0
for a in range(0, F+1, A*100):
    for b in range(0, F-a+1, B*100):
        if a + b == 0:
            continue

        for c in range(0, F-a-b+1, C):
            for d in range(0, F-a-b-c+1, D):
                x = 100 * (c + d) / (a + b)
                if x <= E and mx < x:
                    mx = x
                    ans = (a + b + c + d), int(x)
print(*ans)

Fixed submission:
A, B, C, D, E, F = map(int, input().split())
W = set()
for a in range(0, F+1, 100*A):
    for b in range(0, F+1, 100*B):
        W.add(a+b)
S = set()
for c in range(0, F+1, C):
    for d in range(0, F+1, D):
        S.add(c+d)

rate = -1
for w in W:
    for s in S:
        if 0 < w + s <= F and s * 100 <= E * w:
            if s / (s + w) > rate:
                rate = s / (s + w)
                ans = w + s, s
print(ans[0], ans[1])

Buggy python submission (verdict: Runtime Error):
A, B, C, D, E, F = map(int, input().split())


ws = set()
ss = set()
for a in range(0, F+1, A*100):
    for b in range(0, F-a+1, B*100):
        ws.add(a + b)

for c in range(0, F+1, C):
    for d in range(0, F-c+1, D):
        ss.add(c + d)

mx = 0
ans = None
for w in ws:
    if w == 0:
        continue
    for s in ss:
        x = s * 100 / w
        if w + s <= F and x <= E and mx < x:
            mx = x
            ans = [s + w, s]

print(' '.join(map(str, ans)))


Fixed submission:
A, B, C, D, E, F = map(int, input().split())
W = set()
for a in range(0, F+1, 100*A):
    for b in range(0, F+1, 100*B):
        W.add(a+b)
S = set()
for c in range(0, F+1, C):
    for d in range(0, F+1, D):
        S.add(c+d)

rate = -1
for w in W:
    for s in S:
        if 0 < w + s <= F and s * 100 <= E * w:
            if s / (s + w) > rate:
                rate = s / (s + w)
                ans = w + s, s
print(ans[0], ans[1])

Buggy python submission (verdict: Runtime Error):
A, B, C, D, E, F = map(int, input().split())


ws = set()
ss = set()
for a in range(0, F+1, A*100):
    for b in range(0, F-a+1, B*100):
        if a + b == 0:
            continue
        ws.add(a + b)

for c in range(0, F+1, C):
    for d in range(0, F-c+1, D):
        ss.add(c + d)

mx = 0
ans = None
for w in ws:
    for s in ss:
        x = s * 100 / w
        if w + s <= F and x <= E and mx < x:
            mx = x
            ans = [s + w, s]

print(*ans)


Fixed submission:
A, B, C, D, E, F = map(int, input().split())
W = set()
for a in range(0, F+1, 100*A):
    for b in range(0, F+1, 100*B):
        W.add(a+b)
S = set()
for c in range(0, F+1, C):
    for d in range(0, F+1, D):
        S.add(c+d)

rate = -1
for w in W:
    for s in S:
        if 0 < w + s <= F and s * 100 <= E * w:
            if s / (s + w) > rate:
                rate = s / (s + w)
                ans = w + s, s
print(ans[0], ans[1])

Buggy python submission (verdict: Runtime Error):
A, B, C, D, E, F = map(int, input().split())

mx = 0
ans = None
for a in range(0, F+1, A*100):
    for b in range(0, F-a+1, B*100):
        if a + b == 0:
            continue

        for c in range(0, F-a-b+1, C):
            for d in range(0, F-a-b-c+1, D):
                if c + d == 0:
                    continue
                x = 100 * (c + d) / (a + b)
                if x <= E and mx < x:
                    mx = x
                    ans = ((a + b + c + d), int(x))
print(*ans)


Fixed submission:
A, B, C, D, E, F = map(int, input().split())
W = set()
for a in range(0, F+1, 100*A):
    for b in range(0, F+1, 100*B):
        W.add(a+b)
S = set()
for c in range(0, F+1, C):
    for d in range(0, F+1, D):
        S.add(c+d)

rate = -1
for w in W:
    for s in S:
        if 0 < w + s <= F and s * 100 <= E * w:
            if s / (s + w) > rate:
                rate = s / (s + w)
                ans = w + s, s
print(ans[0], ans[1])