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