#include #include #include #include #include #include #include #include #include #include #include using namespace std; #define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++) #define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--) #define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end()) typedef long long ll; ll N,X,A,B; bool check1(long long x) { ll t = X - x * A; if (t <= 0) return true; return false; } long long BinarySearchMin1(long long low, long long high) { while (high - low > 1){ long long mid = (low + high) / 2; if (check1(mid)) high = mid; else low = mid; } return high; } bool check2(long long x) { ll t = X + x * B; if (t >= (1LL << (N - 1))) return true; return false; } long long BinarySearchMin2(long long low, long long high) { while (high - low > 1){ long long mid = (low + high) / 2; if (check2(mid)) high = mid; else low = mid; } return high; } int main() { cin >> N >> X >> A >> B; cout << min(BinarySearchMin1(0, 1LL << 31LL), BinarySearchMin2(0, 1LL << 31LL)) << endl; return 0; }