import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); int d = sc.nextInt(); int cnt = 0; while (true) { cnt++; if(cnt == a + 1){ break; } if (cnt * c > b) { break; } if (cnt + b > d) { break; } } System.out.println(cnt - 1); sc.close(); } }