#include using namespace std; #define chmax(x, y) x = max(x, y) int main(){ int a, b, c, d; cin >> a >> b >> c >> d; int ans = 0; for(int i = 1; i <= a; ++i){ int foo = i * c; if(foo > b) continue; if(foo + i > d) continue; chmax(ans, i); } cout << ans << endl; }