main = do n <- readLn x <- readLn a <- readLn b <- readLn let x1 = (x + a - 1) `div` a let x2 = (2^(n-1) - x + b - 1) `div` b print $ min x1 x2