#include using namespace std; typedef long long ll; typedef pair P; typedef pair Q; #define REP(i,n) for(int i=0;i> A >> B >> C >> D; if(A!=0 && B!=0) cout << min(C/A,D/B) << endl; else if(A==0) cout << D/B << endl; else if(B==0) cout << C/A << endl; return 0; }