//#pragma GCC optimize("Ofast") //#pragma GCC optimize("unroll-loops") #include using namespace std; using ll = long long; using ld = long double; using P = pair; using vi = vector; using vd = vector; using vP = vector

; using vvi = vector>; using vvd = vector>; using vvP = vector>; using vvvi = vector>>; using vvvd = vector>>; using vvvP = vector>>; #if __has_include() #include using namespace atcoder; using mint = modint998244353; using Mint = modint1000000007; using vm = vector; using vM = vector; using vvm = vector>; using vvM = vector>; using vvvm = vector>>; using vvvM = vector>>; #endif #define rrep(i, n) for (ll i = (n)-1; (i) >= 0; --(i)) #define rep(i, n) for (ll i = 0; (i) < (n); ++(i)) #define reps(i, n) for (ll i = 1; (i) <= (n); ++(i)) #define Rep(i,a,b) for(ll i = (a); i <= (b); i++) #define all(a) (a).begin(),(a).end() const ll MOD = 998244353; #define Yes(b) ((b)?"Yes":"No") #define YES(b) ((b)?"YES":"NO") #define ft first #define sd second bool chmin(ll& a, ll b) { return a > b ? a = b, 1 : 0; } bool chmax(ll& a, ll b) { return a < b ? a = b, 1 : 0; } signed main(){ cin.tie(nullptr); ios_base::sync_with_stdio(false); cout << fixed << setprecision(20); ll A, B, C, D; cin >> A >> B >> C >> D; if(A == 0) {A == 1, B = 4e18;} if(B == 0) {B == 1, A = 4e18;} ll ans = min(C / A, D / B); cout << ans << endl; }