#include int main(){ int A,B,C,D,ans=0; scanf("%d %d %d %d",&A,&B,&C,&D); while(true){ if(A>0 && B>=C && D>=1+C){ ans++;A--;B-=C;D=D-(1+C); }else break; } printf("%d\n",ans); return 0; }