fun main(args: Array) { val (a,b,c,d) = readLine()!!.split(" ").map { it.toInt() } val ans = (d/(c+1)).let { Math.min(a,it) }.let { Math.min(b, it*c)/c } println(ans) }