#include using namespace std; int main() { int A, B, C, D; cin >> A >> B >> C >> D; int ans1; int ans2; if (A == 0) { ans1 = 1e9; } else { ans1 = C / A; } if (B == 0) { ans2 = 1e9; } else { ans2 = D / B; } cout << min(ans1, ans2); }