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