#include #include #include using namespace std; int main() { int A, B, C, D; cin >> A >> B >> C >> D; int a = 0; for (a = 0; a <= A; a++) { if (a * C > B || a + a * C > D) { break; } } cout << a << endl; }