import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
int x = sc.nextInt();
int y = sc.nextInt();
if((m / x) >= n){
System.out.println(n);
}else{
int total = m / x;
n = n - total;
if(n <= 1){
System.out.println(total);
}else{
System.out.println(total+1);
}
}
}
}
i am not getting how to solve this problem.