#include using namespace std; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int a, b, c, d; cin >> a >> b >> c >> d; int maxi = 0; for(int i = 1; i <= a; i++){ if(i + c * i <= d and c * i <= b){ maxi = max(maxi, i); } } cout << maxi << endl; return 0; }