#include using namespace std; int main() { int a, b, c, d; cin >> a >> b >> c >> d; int ans = 0; for (int i = 0; i <= a; i++) { int res = i + i * c; if (res <= d and i * c <= b) ans = i; } cout << ans << endl; return 0; }