import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long x = sc.nextInt(); long a = sc.nextInt(); long b = sc.nextInt(); long ans = Math.min((x + a - 1) / a, ((1L << (n - 1)) - x + b - 1) / b); System.out.println(ans); } }