#include using namespace std; int main(void) { int a, b, c, d; cin >> a >> b >> c >> d; int ans = min(a, b / c); ans = min(ans, d / (c + 1)); cout << ans << endl; return 0; }