#define _USE_MATH_DEFINES #include //cin, cout #include //vector #include //sort,min,max,count #include //string,getline, to_string #include //fixed #include //setprecision #include //swap, pair #include //abs(int) #include //sqrt,ceil,M_PI, pow, sin #include //stringstream,getline #include //gcd, accumlate #include //deque #include //randam_device #include //numeric_limits using namespace std; constexpr long long int D_MOD = 1000000007; int main() { int a, b, c, d; cin >> a >> b >> c >> d; int ans = 0; while (1) { if (a > 0) { if (b >= c) { if (c + 1 <= d) { ans++; a = a - 1; b = b - c; d = d - (c + 1); } else { break; } } else { break; } } else { break; } } cout << ans << endl; return 0; }