import java.util.Scanner; class Main{ public static void main(String[] args) { Scanner sc=new Scanner(System.in); long n=sc.nextLong(),x=sc.nextLong(),a=sc.nextLong(),b=sc.nextLong(); sc.close(); if((x+a-1)/a>((long)Math.pow(2, n-1)-1-x+b)/b) System.out.print(((long)Math.pow(2, n-1)-1-x+b)/b); else System.out.print((x+a-1)/a); } }