#include <iostream>

void solve() {
    int a, b, c, d;
    std::cin >> a >> b >> c >> d;

    int x;
    for (x = 1; x <= a; ++x) {
        if (x * c > b || x * (c + 1) > d) break;
    }

    std::cout << x - 1 << std::endl;
}

int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);

    solve();

    return 0;
}