#include using namespace std; typedef long long ll; int main() { int A, B, C, D; cin >> A >> B >> C >> D; // k + kC <= D k <= A kC <= B cout << min(D / (1 + C), min(A, B / C)) << "\n"; return 0; }