#include "bits/stdc++.h" using namespace std; void solve() { int A, B, C, D; cin >> A >> B >> C >> D; int ans = D / (C + 1); ans = min(ans, A); ans = min(ans, B / C); cout << ans << endl; return; } int main() { solve(); }