long a,b,n,x;main(){scanf("%ld%ld%ld%ld",&n,&x,&a,&b);printf("%.f",fmin(1L*((1<<--n)-x+b-1)/b,1L*(x+a-1)/a));}