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