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