import java.util.*; import java.util.stream.Stream; import java.util.stream.IntStream; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String[] sa = sc.nextLine().split(" "); int[] i = Stream.of(sa).mapToInt(Integer::parseInt).toArray(); List list = new ArrayList<>(); list.add(i[0]); list.add( i[1] / i[2] ); list.add( i[3] / (1 + i[2]) ); Optional min = list.stream().min((a, b) -> a.compareTo(b)); System.out.println(min.get()); } }