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