#include #define rep(i,n) for(int i=0;i=0;i--) #define FOR(i,m,n) for(int i=m;i inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } //const ll INF = 1LL << 60; //const int INF = 1001001001; int main(void){ int a,b,c,d; cin >> a >> b >> c >> d; int x=floor((double)b/(double)c); int ans=0; for(int i=1;i<=a;i++){ if(i*c>b) break; if(i+i*c<=d)ans=i; } cout << ans << endl; return 0; }