#include using namespace std; using lint = long long; template using V = vector; template using VV = V< V >; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int a, b, c, d; cin >> a >> b >> c >> d; int res; for (int x = 0; ; ++x) { if (x > a) break; if (c * x > b) break; if (x + c * x > d) break; res = x; } cout << res << '\n'; }