($A,$B,$C,$D)=glob<>; $k++while$k<=$A&&$k*$C<=$B&&$k*($C+1)<=$D; print$k-1