Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,d,e,f=map(lambda x: int(x), input().split())

dic_w={}
i=0
while True:
    if (a*i*100)>f:
        break
    j=0
    while True:
        w=(a*i+b*j)*100
        if w==0:
            continue
        if w>f:
            break
        else:
            dic_w[w]=dic_w.get(w,0)+1
        j+=1
    i+=1
list_w=list(dic_w.keys())
list_w.sort()

dic_s={}
max_s=int(e*f/(100+e))
i=0
while True:
    if c*i>max_s:
        break
    j=0
    while True:
        s=c*i+d*j
        if s>max_s:
            break
        else:
            dic_s[s]=dic_s.get(s,0)+1
        j+=1
    i+=1
list_s=list(dic_s.keys())
list_s.sort()

max_per=0
flag=False
ans_w=0
ans_s=0
for w in list_w:
    if flag==True:
        break
    for s in list_s:
        if s/(w/100)==e and s+w<=f:
            ans_w=w
            ans_s=s
            flag=True
            break
        if s/(w/100)>e:
            break
        if s/(w/100)>max_per and s+w<=f:
            ans_w=w
            ans_s=s
print('{} {}'.format(ans_w+ans_s,ans_s))

Fixed submission:
a,b,c,d,e,f=map(lambda x: int(x), input().split())

dic_w={}
i=0
while True:
    if (a*i*100)>f:
        break
    j=0
    while True:
        w=(a*i+b*j)*100
        if w==0:
            j+=1
            continue
        if w>f:
            break
        else:
            dic_w[w]=dic_w.get(w,0)+1
        j+=1
    i+=1
list_w=list(dic_w.keys())
list_w.sort()

dic_s={}
max_s=int(e*f/(100+e)+1)
i=0
while True:
    if c*i>max_s:
        break
    j=0
    while True:
        s=c*i+d*j
        if s>max_s:
            break
        else:
            dic_s[s]=dic_s.get(s,0)+1
        j+=1
    i+=1
list_s=list(dic_s.keys())
list_s.sort()

max_per=0
flag=False
ans_w=0
ans_s=0
for w in list_w:
    if flag==True:
        break
    for s in list_s:
        if s/(w/100)==e and s+w<=f:
            ans_w=w
            ans_s=s
            flag=True
            break
        if s/(w/100)>e:
            break
        if 100*s/(s+w)>=max_per and s+w<=f:
            ans_w=w
            ans_s=s
            max_per=100*s/(s+w)
print('{} {}'.format(ans_w+ans_s,ans_s))

Buggy python submission (verdict: Runtime Error):
a,b,c,d,e,f=map(lambda x: int(x), input().split())

dic_w={}
i=0
while True:
    if (a*i*100)>f:
        break
    j=0
    while True:
        w=(a*i+b*j)*100
        if w>f:
            break
        else:
            dic_w[w]=dic_w.get(w,0)+1
        j+=1
    i+=1
list_w=list(dic_w.keys())
list_w.sort()

dic_s={}
max_s=int(e*f/(100+e))
i=0
while True:
    if c*i>max_s:
        break
    j=0
    while True:
        s=c*i+d*j
        if s>max_s:
            break
        else:
            dic_s[s]=dic_s.get(s,0)+1
        j+=1
    i+=1
list_s=list(dic_s.keys())
list_s.sort()

max_per=0
flag=False
ans_w=0
ans_s=0
for w in list_w:
    if flag==True:
        break
    for s in list_s:
        if s/(w/100)==e and s+w<=f:
            ans_w=w
            ans_s=s
            flag=True
            break
        if s/(w/100)>e:
            break
        if s/(w/100)>max_per and s+w<=f:
            ans_w=w
            ans_s=s
print('{} {}'.format(ans_w+ans_s,ans_s))

Fixed submission:
a,b,c,d,e,f=map(lambda x: int(x), input().split())

dic_w={}
i=0
while True:
    if (a*i*100)>f:
        break
    j=0
    while True:
        w=(a*i+b*j)*100
        if w==0:
            j+=1
            continue
        if w>f:
            break
        else:
            dic_w[w]=dic_w.get(w,0)+1
        j+=1
    i+=1
list_w=list(dic_w.keys())
list_w.sort()

dic_s={}
max_s=int(e*f/(100+e)+1)
i=0
while True:
    if c*i>max_s:
        break
    j=0
    while True:
        s=c*i+d*j
        if s>max_s:
            break
        else:
            dic_s[s]=dic_s.get(s,0)+1
        j+=1
    i+=1
list_s=list(dic_s.keys())
list_s.sort()

max_per=0
flag=False
ans_w=0
ans_s=0
for w in list_w:
    if flag==True:
        break
    for s in list_s:
        if s/(w/100)==e and s+w<=f:
            ans_w=w
            ans_s=s
            flag=True
            break
        if s/(w/100)>e:
            break
        if 100*s/(s+w)>=max_per and s+w<=f:
            ans_w=w
            ans_s=s
            max_per=100*s/(s+w)
print('{} {}'.format(ans_w+ans_s,ans_s))