a, b, c, d = gets.split.map(&:to_i) puts [d/(c+1), a, b/c].min