#include using namespace std; int main() { cin.sync_with_stdio(0), cin.tie(0), cout.tie(0); int a, b, c, d; cin >> a >> b >> c >> d; int y = d / (c + 1); if (a * c <= b) { cout << a << endl; } else if (y <= a && y * c <= b) { cout << y << endl; } else if (y <= a) { cout << b / c << endl; } else if (y * c <= b) { cout << a << endl; } }