public class WinningScholarship {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner s = new Scanner(System.in);
int N = s.nextInt();
int M = s.nextInt();
int X = s.nextInt();
int Y = s.nextInt();
int lo = 0;
int hi = N;
int Max = 0;
while(lo <= hi) {
int mid = (lo+hi) / 2;
if(check(mid, N, M, X, Y)) {
lo = mid +1;
Max = mid;
}else {
hi = mid - 1;
}
}
System.out.println(Max);
s.close();
}
private static boolean check(int z, int n, int m, int x, int y) {
// TODO Auto-generated method stub
return (z*x <= m + (n-z) * y);
}