n,x,a,b=[int(input()) for _ in range(4)] print(min((x-1)//a,(2**(n-1)-x-1)//b)+1)