N = int(input()) X = int(input()) A = int(input()) B = int(input()) a = (X+A-1)//A b = (pow(2,N-1)-X+B-1)//B print(min(a,b))