import math n = int(input()) x = int(input()) a = int(input()) b = int(input()) max = 2**(n - 1) - 1 h = math.ceil((max - x + 1) / b) d = math.ceil(x / a) print(min(h, d))