#include #define rep(i,a,b) for(int i=a;i=b;i--) #define fore(i,a) for(auto &i:a) #pragma GCC optimize ("-O3") using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); } //--------------------------------------------------------------------------------------------------- /*---------------------------------------------------------------------------------------------------             ∧_∧       ∧_∧  (´<_` )  Welcome to My Coding Space!      ( ´_ゝ`) /  ⌒i     /   \    | |     /   / ̄ ̄ ̄ ̄/  |   __(__ニつ/  _/ .| .|____      \/____/ (u ⊃ ---------------------------------------------------------------------------------------------------*/ typedef long long ll; int N; ll X, A, B; //--------------------------------------------------------------------------------------------------- void _main() { cin >> N >> X >> A >> B; // 攻撃で倒す ll attack = X / A; if (X % A != 0) attack++; // 回復で倒す ll x = (1LL << (N - 1)) - X; ll cure = x / B; if (x % B != 0) cure++; ll ans = min(attack, cure); cout << ans << endl; }