#include typedef long long ll; #define FOR(i,a,b) for(ll i=(a);i<(b);i++) #define REP(i,a) FOR(i,0,a) using namespace std; ll A,B,C,D; int main(){ ios::sync_with_stdio(false); cin.tie(0); cin>>A>>B>>C>>D; ll ans=0; FOR(i,1,A+1){ if(i*C<=B && (i+i*C)<=D){ ans=i; } } cout<