#include using namespace std; int main(){ int a, b, c, d; cin >> a >> b >> c >> d; if(1+c > d){ cout << 0 << endl; }else{ cout << min(a, b/c) << endl; } return 0; }