fn main() { let mut xx = String::new(); std::io::stdin().read_line(&mut xx).ok(); let xx: Vec = xx.split_whitespace().flat_map(str::parse).collect(); let max = xx[3] / (1 + xx[2]); let answer = max.min(xx[0]).min(xx[1] / xx[2]); println!("{}", answer); }