#include #include using namespace std; int main(){ int A,B,C,D; cin >> A >> B >> C >> D; cout << min( {D/(C+1),B/C,A} ) << endl; }