n = gets.to_i x = gets.to_i a = gets.to_i b = gets.to_i puts [ (x+a-1)/a, (2**(n-1)-x+b-1)/b ].min