#include using namespace std; using ll = long long; using P = pair; using PL = pair; // Welcome to my source code! int main() { int a, b, c, d; cin >> a >> b >> c >> d; int ans = 0; for (int i = 1; i <= a; i++) { int j = i * c; if (j <= b && i + j <= d) ans = i; } cout << ans << endl; }