#include using namespace std; int main() { int a, b, c, d, ans = 0; cin >> a >> b >> c >> d; while(ans*c <= b && ans*(c+1) <= d && ans <= a){ ++ans; } cout << ans - 1 << endl; return 0; }