import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st=new StringTokenizer(br.readLine());
int N=Integer.parseInt(st.nextToken());
int M=Integer.parseInt(st.nextToken());
int X=Integer.parseInt(st.nextToken());
int Y=Integer.parseInt(st.nextToken());
System.out.println(Search(N, M, X, Y));
}public static int Search(int N,int M,int X,int Y) {
int ans=0;
int low=0;
int high=N;
while(low<=high) {
int mid=low+(high-low)/2;
if(mid*X<=M+((N-mid)*Y)) {
low=mid+1;
ans=mid;
}else {
high=mid-1;
}
}
return ans;
}
}
Please tell me why i am failing test cases