Buggy python submission (verdict: Time Limit Exceeded):
A, B, C, D, E, F = map(int, input().split())
dens = 0
ans_water = 0
ans_sugar = 0
for i in range(31):
    for j in range(31):
        for k in range(101):
            for l in range(101):
                water = 100*A*i+100*B*j
                sugar = C*k+D*l
                if i==j==0:
                    break
                if water+sugar <= F and sugar <= E*(A*i+B*j):
                    if dens<sugar/(sugar+water):
                        dens = sugar/(sugar+water)
                        ans_water = water
                        ans_sugar = sugar
print(ans_water+ans_sugar, ans_sugar)

Fixed submission:
A, B, C, D, E, F = map(int, input().split())
dens = 0
ans_water = 100*min(A, B)
ans_sugar = 0
for i in range(31):
    for j in range((F-(100*A*i))//(100*B)+1):
        for k in range((F-(100*A*i)-(100*B*j))//C+1):
            for l in range((F-(100*A*i)-(100*B*j)-(C*k))//D+1):
                water = 100*A*i+100*B*j
                sugar = C*k+D*l
                if water == 0:
                    break
                if sugar <= E*(A*i+B*j):
                    if dens<sugar/(sugar+water):
                        dens = sugar/(sugar+water)
                        ans_water = water
                        ans_sugar = sugar
print(ans_water+ans_sugar, ans_sugar)

Buggy python submission (verdict: Runtime Error):
dens = 0
ans_water = 0
ans_sugar = 0
for i in range(31):
    for j in range((F-(100*A*i))//(100*B)+1):
        for k in range((F-(100*A*i)-(100*B*j))//C+1):
            for l in range((F-(100*A*i)-(100*B*j)-(100*C*k))//D+1):
                water = 100*A*i+100*B*j
                sugar = C*k+D*l
                if i==j==0:
                    break
                if water+sugar <= F and sugar <= E*(A*i+B*j):
                    if dens<sugar/(sugar+water):
                        dens = sugar/(sugar+water)
                        ans_water = water
                        ans_sugar = sugar
print(ans_water+ans_sugar, ans_sugar)

Fixed submission:
A, B, C, D, E, F = map(int, input().split())
dens = 0
ans_water = 100*min(A, B)
ans_sugar = 0
for i in range(31):
    for j in range((F-(100*A*i))//(100*B)+1):
        for k in range((F-(100*A*i)-(100*B*j))//C+1):
            for l in range((F-(100*A*i)-(100*B*j)-(C*k))//D+1):
                water = 100*A*i+100*B*j
                sugar = C*k+D*l
                if water == 0:
                    break
                if sugar <= E*(A*i+B*j):
                    if dens<sugar/(sugar+water):
                        dens = sugar/(sugar+water)
                        ans_water = water
                        ans_sugar = sugar
print(ans_water+ans_sugar, ans_sugar)

Buggy python submission (verdict: Runtime Error):
dens = 0
ans_water = 0
ans_sugar = 0
for i in range(31):
    for j in range(31):
        for k in range(101):
            water = 100*A*i+100*B*j
            sugar = C*k+D*(((A*i+B*j)*E-C*k)//D)
            if water == 0:
                continue
            if water+sugar <= F and dens <= sugar/(sugar+water):
                    dens = sugar/(sugar+water)
                    ans_water = water
                    ans_sugar = sugar
print(ans_water+ans_sugar, ans_sugar)

Fixed submission:
A, B, C, D, E, F = map(int, input().split())
dens = 0
ans_water = 100*min(A, B)
ans_sugar = 0
for i in range(31):
    for j in range((F-(100*A*i))//(100*B)+1):
        for k in range((F-(100*A*i)-(100*B*j))//C+1):
            for l in range((F-(100*A*i)-(100*B*j)-(C*k))//D+1):
                water = 100*A*i+100*B*j
                sugar = C*k+D*l
                if water == 0:
                    break
                if sugar <= E*(A*i+B*j):
                    if dens<sugar/(sugar+water):
                        dens = sugar/(sugar+water)
                        ans_water = water
                        ans_sugar = sugar
print(ans_water+ans_sugar, ans_sugar)

Buggy python submission (verdict: Time Limit Exceeded):
A, B, C, D, E, F = map(int, input().split())
dens = 0
ans_water = 0
ans_sugar = 0
for i in range(31):
    for j in range(31):
        for k in range(101):
            for l in range(101):
                water = 100*A*i+100*B*j
                sugar = C*k+D*l
                if i==j==0:
                    break
                if water+sugar <= F and sugar <= E*(A*i+B*j):
                    if dens<sugar/(sugar+water):
                        dens = sugar/(sugar+water)
                        ans_water = water
                        ans_sugar = sugar
print(ans_water+ans_sugar, ans_sugar)

Fixed submission:
A, B, C, D, E, F = map(int, input().split())
dens = 0
ans_water = 100*min(A, B)
ans_sugar = 0
for i in range(31):
    for j in range((F-(100*A*i))//(100*B)+1):
        for k in range((F-(100*A*i)-(100*B*j))//C+1):
            for l in range((F-(100*A*i)-(100*B*j)-(C*k))//D+1):
                water = 100*A*i+100*B*j
                sugar = C*k+D*l
                if water == 0:
                    break
                if sugar <= E*(A*i+B*j):
                    if dens<sugar/(sugar+water):
                        dens = sugar/(sugar+water)
                        ans_water = water
                        ans_sugar = sugar
print(ans_water+ans_sugar, ans_sugar)

Buggy python submission (verdict: Runtime Error):
dens = 0
ans_water = 0
ans_sugar = 0
for i in range(31):
    for j in range(31):
        for k in range(101):
            for l in range(101):
                water = 100*A*i+100*B*j
                sugar = C*k+D*l
                if i==j==0:
                    break
                if water+sugar <= F and sugar <= E*(A*i+B*j):
                    if dens<sugar/(sugar+water):
                        dens = sugar/(sugar+water)
                        ans_water = water
                        ans_sugar = sugar
print(ans_water+ans_sugar, ans_sugar)

Fixed submission:
A, B, C, D, E, F = map(int, input().split())
dens = 0
ans_water = 100*min(A, B)
ans_sugar = 0
for i in range(31):
    for j in range((F-(100*A*i))//(100*B)+1):
        for k in range((F-(100*A*i)-(100*B*j))//C+1):
            for l in range((F-(100*A*i)-(100*B*j)-(C*k))//D+1):
                water = 100*A*i+100*B*j
                sugar = C*k+D*l
                if water == 0:
                    break
                if sugar <= E*(A*i+B*j):
                    if dens<sugar/(sugar+water):
                        dens = sugar/(sugar+water)
                        ans_water = water
                        ans_sugar = sugar
print(ans_water+ans_sugar, ans_sugar)

Buggy python submission (verdict: Runtime Error):
water = 0
sugar = 0
for i in range(F//(100*A)+1):
    for j in range(F//(100*B)+1):
        for k in range(F//C+1):
            for l in range(F//D+1):
                water = 100*i+100*j
                sugar = k+l
                if water+sugar <= F and sugar <= E//100*water:
                    break
print(water+sugar, sugar)

Fixed submission:
A, B, C, D, E, F = map(int, input().split())
dens = 0
ans_water = 100*min(A, B)
ans_sugar = 0
for i in range(31):
    for j in range((F-(100*A*i))//(100*B)+1):
        for k in range((F-(100*A*i)-(100*B*j))//C+1):
            for l in range((F-(100*A*i)-(100*B*j)-(C*k))//D+1):
                water = 100*A*i+100*B*j
                sugar = C*k+D*l
                if water == 0:
                    break
                if sugar <= E*(A*i+B*j):
                    if dens<sugar/(sugar+water):
                        dens = sugar/(sugar+water)
                        ans_water = water
                        ans_sugar = sugar
print(ans_water+ans_sugar, ans_sugar)