#include using ll = long long; using llu = long long unsigned; using namespace std; int main() { int A, B, C, D; cin >> A >> B >> C >> D; int result = 0; for (int i=1; i<=A; i++) { if ((C+1)*i > D) { result = i-1; break; } if (C*i > B) { result = i-1; break; } } cout << result << endl; return 0; }