Why is second Subtask failing (with WA), while first one succeeds (while logic is the same)?

def gcd(a, b):
while b:
    a, b = b, a%b
return a

T = int(input())

while T>0:
T -= 1
N, A, B, K = map(int, input().split())
if(N//A + N//B - 2*N//(A*B//gcd(A, B)) >= K): print("Win")
else: print("Lose")

This is a reference to the practice problem HMAPPY2