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

from fractions import gcd

highest_concentration=0

for a in range(F//(100*A) +1):
  for b in range((F-100*A*a)//(100*B) +1):
    water = 100*A*a + 100*B*b
    if not water:
      continue
    max_sugar = min(E*(A*a+B*b), F-water)
    
    lcm = C*D//gcd(C,D)
    
    #(max_sugar//lcm)*lcm
    for c in range((max_sugar%lcm)//C + 1):
      d = (max_sugar%lcm -c*C)//D
      
      sugar = (max_sugar//lcm)*lcm + c*C + d*D
      if sugar/(water+sugar) > highest_concentration:
        highest_concentration = sugar/(water+sugar)
        #print(a,b,c,d, 100*a*A+100*b*B, sugar)
        #print(water,water+sugar, sugar)
        answer = (water+sugar, sugar)
        
print(*answer)

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

from fractions import gcd

highest_concentration=-1

for a in range(F//(100*A) +1):
  for b in range((F-100*A*a)//(100*B) +1):
    water = 100*A*a + 100*B*b
    if not water:
      continue
      
    max_sugar = min(E*(A*a+B*b), F-water)
    
    for c in range(min(D,(max_sugar//C)+1)):
      d = (max_sugar -c*C)//D
      sugar = c*C + d*D
      if sugar/(water+sugar) > highest_concentration:
        highest_concentration = sugar/(water+sugar)
        #print(a,b,c,d, 100*a*A+100*b*B, sugar)
        #print(water,water+sugar, sugar)
        answer = (water+sugar, sugar)
        
print(*answer)

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

from fractions import gcd

highest_concentration=0

for a in range(F//(100*A) +1):
  for b in range((F-100*A*a)//(100*B) +1):
    water = 100*A*a + 100*B*b
    if not water:
      continue
    max_sugar = min(E*(A*a+B*b), F-water)
    
    lcm = C*D//gcd(C,D)
    
    #(max_sugar//lcm)*lcm
    for c in range((max_sugar%lcm)//C + 1):
      d = (max_sugar%lcm -c*C)//D
      
      sugar = (max_sugar//lcm)*lcm + c*C + d*D
      if sugar/(water+sugar) > highest_concentration:
        highest_concentration = sugar/(water+sugar)
        #print(a,b,c,d, 100*a*A+100*b*B, sugar)
        #print(water,water+sugar, sugar)
        answer = (water+sugar, sugar)
print(*answer)A,B,C,D,E,F=list(map(int, input().split()))

from fractions import gcd

highest_concentration=0

for a in range(F//(100*A) +1):
  for b in range((F-100*A*a)//(100*B) +1):
    water = 100*A*a + 100*B*b
    if not water:
      continue
    max_sugar = min(E*(A*a+B*b), F-water)
    
    lcm = C*D//gcd(C,D)
    
    #(max_sugar//lcm)*lcm
    for c in range((max_sugar%lcm)//C + 1):
      d = (max_sugar%lcm -c*C)//D
      
      sugar = (max_sugar//lcm)*lcm + c*C + d*D
      if sugar/(water+sugar) > highest_concentration:
        highest_concentration = sugar/(water+sugar)
        #print(a,b,c,d, 100*a*A+100*b*B, sugar)
        #print(water,water+sugar, sugar)
        answer = (water+sugar, sugar)
print(*answer)

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

from fractions import gcd

highest_concentration=-1

for a in range(F//(100*A) +1):
  for b in range((F-100*A*a)//(100*B) +1):
    water = 100*A*a + 100*B*b
    if not water:
      continue
      
    max_sugar = min(E*(A*a+B*b), F-water)
    
    for c in range(min(D,(max_sugar//C)+1)):
      d = (max_sugar -c*C)//D
      sugar = c*C + d*D
      if sugar/(water+sugar) > highest_concentration:
        highest_concentration = sugar/(water+sugar)
        #print(a,b,c,d, 100*a*A+100*b*B, sugar)
        #print(water,water+sugar, sugar)
        answer = (water+sugar, sugar)
        
print(*answer)