F = input() E = F.split(" ") A = int(E[0]) B = int(E[1]) C = int(E[2]) D = int(E[3]) G = 0 while G*C + G <= D: G += 1 if G-1 > A: print("0") else: print(G-1)