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