Buggy python submission (verdict: Time Limit Exceeded):
#ABC074C
A, B, C, D, E, F=map(int, input().split())
A=100*A
B=100*B
count_A=F//A
count_B=F//B
count_C=F//C
count_D=F//D
max=-1
ans=[0]*2
total=0
density=0
for i in range(count_A+1):
    for j in range(count_B+1):
        if i*A+j*B<=F and 0<i*A+j*B:
            for k in range(count_C+1):
                if i*A+j*B+k*C<=F:
                    for l in range(count_D+1):
                        total=i*A+j*B+k*C+l*D
                        if total!=0:
                            density=(k*C+l*D)/total
                            if total<=F and density<=E/(100+E) and max<=density:
                                max=density
                                ans[0]=total
                                ans[1]=k*C+l*D
                                if density==E/(100+E):
                                    break
print(' '.join(map(str, ans)))


Fixed submission:
#ABC074C
A, B, C, D, E, F=map(int, input().split())
A=100*A
B=100*B
count_A=F//A
count_B=F//B
count_C=F//C
count_D=F//D
max=-1
ans=[0]*2
total=0
density=0
for i in range(count_A+1):
    for j in range(count_B+1):
        if i*A+j*B<=F and 0<i*A+j*B:
            for k in range(count_C+1):
                if i*A+j*B+k*C<=F:
                    for l in range(count_D+1):
                        total=i*A+j*B+k*C+l*D
                        if total!=0:
                            density=(k*C+l*D)/total
                            if total<=F and density<=E/(100+E) and max<density:
                                max=density
                                ans[0]=total
                                ans[1]=k*C+l*D
                                if density==E/(100+E):
                                    print(' '.join(map(str, ans)))
                                    exit()
print(' '.join(map(str, ans)))

Buggy python submission (verdict: Time Limit Exceeded):
#ABC074C
A, B, C, D, E, F=map(int, input().split())
A=100*A
B=100*B
count_A=F//A
count_B=F//B
count_C=F//C
count_D=F//D
max=0
ans=[0]*2
total=0
density=0
for i in range(count_A+1):
    for j in range(count_B+1):
        if i*A+j*B<=F:
            for k in range(count_C+1):
                if i*A+j*B+k*C<=F:
                    for l in range(count_D+1):
                        total=i*A+j*B+k*C+l*D
                        if total!=0:
                            density=(k*C+l*D)/total
                            if total<=F and density<=E/(100+E) and max<=density:
                                max=density
                                ans[0]=total
                                ans[1]=k*C+l*D
                                if density==E/(100+E):
                                    break
print(' '.join(map(str, ans)))



Fixed submission:
#ABC074C
A, B, C, D, E, F=map(int, input().split())
A=100*A
B=100*B
count_A=F//A
count_B=F//B
count_C=F//C
count_D=F//D
max=-1
ans=[0]*2
total=0
density=0
for i in range(count_A+1):
    for j in range(count_B+1):
        if i*A+j*B<=F and 0<i*A+j*B:
            for k in range(count_C+1):
                if i*A+j*B+k*C<=F:
                    for l in range(count_D+1):
                        total=i*A+j*B+k*C+l*D
                        if total!=0:
                            density=(k*C+l*D)/total
                            if total<=F and density<=E/(100+E) and max<density:
                                max=density
                                ans[0]=total
                                ans[1]=k*C+l*D
                                if density==E/(100+E):
                                    print(' '.join(map(str, ans)))
                                    exit()
print(' '.join(map(str, ans)))

Buggy python submission (verdict: Time Limit Exceeded):
#ABC074C
A, B, C, D, E, F=map(int, input().split())
A=100*A
B=100*B
count_A=F//A
count_B=F//B
count_C=F//C
count_D=F//D
max=0
ans=[0]*2
total=0
density=0
for i in range(count_A+1):
    for j in range(count_B+1):
        for k in range(count_C+1):
            for l in range(count_D+1):
                total=i*A+j*B+k*C+l*D
                if total!=0:
                    density=(k*C+l*D)/total
                    if total<=F and density<=E/(100+E) and max<=density:
                        max=density
                        ans[0]=total
                        ans[1]=k*C+l*D
                        if density==E/(100+E):
                            break
print(' '.join(map(str, ans)))


Fixed submission:
#ABC074C
A, B, C, D, E, F=map(int, input().split())
A=100*A
B=100*B
count_A=F//A
count_B=F//B
count_C=F//C
count_D=F//D
max=-1
ans=[0]*2
total=0
density=0
for i in range(count_A+1):
    for j in range(count_B+1):
        if i*A+j*B<=F and 0<i*A+j*B:
            for k in range(count_C+1):
                if i*A+j*B+k*C<=F:
                    for l in range(count_D+1):
                        total=i*A+j*B+k*C+l*D
                        if total!=0:
                            density=(k*C+l*D)/total
                            if total<=F and density<=E/(100+E) and max<density:
                                max=density
                                ans[0]=total
                                ans[1]=k*C+l*D
                                if density==E/(100+E):
                                    print(' '.join(map(str, ans)))
                                    exit()
print(' '.join(map(str, ans)))

Buggy python submission (verdict: Time Limit Exceeded):
#ABC074C
A, B, C, D, E, F=map(int, input().split())
A=100*A
B=100*B
count_A=F//A
count_B=F//B
count_C=F//C
count_D=F//D
max=0
ans=[0]*2
total=0
density=0
for i in range(count_A+1):
    for j in range(count_B+1):
        for k in range(count_C+1):
            for l in range(count_D+1):
                total=i*A+j*B+k*C+l*D
                if total!=0:
                    density=(k*C+l*D)/total
                    if total<=F and density<=E/(100+E) and max<=density:
                        max=density
                        ans[0]=total
                        ans[1]=k*C+l*D
print(' '.join(map(str, ans)))

Fixed submission:
#ABC074C
A, B, C, D, E, F=map(int, input().split())
A=100*A
B=100*B
count_A=F//A
count_B=F//B
count_C=F//C
count_D=F//D
max=-1
ans=[0]*2
total=0
density=0
for i in range(count_A+1):
    for j in range(count_B+1):
        if i*A+j*B<=F and 0<i*A+j*B:
            for k in range(count_C+1):
                if i*A+j*B+k*C<=F:
                    for l in range(count_D+1):
                        total=i*A+j*B+k*C+l*D
                        if total!=0:
                            density=(k*C+l*D)/total
                            if total<=F and density<=E/(100+E) and max<density:
                                max=density
                                ans[0]=total
                                ans[1]=k*C+l*D
                                if density==E/(100+E):
                                    print(' '.join(map(str, ans)))
                                    exit()
print(' '.join(map(str, ans)))