fn main() { let stdin = std::io::read_to_string(std::io::stdin()).unwrap(); let mut stdin = stdin.split_ascii_whitespace(); let a: u8 = stdin.next().unwrap().parse().unwrap(); let b: u8 = stdin.next().unwrap().parse().unwrap(); let c: u8 = stdin.next().unwrap().parse().unwrap(); let d: u8 = stdin.next().unwrap().parse().unwrap(); println!("{}", output(solve(a, b, c, d))); } fn solve(a: u8, b: u8, c: u8, d: u8) -> u8 { a.min(b / c).min(d / (1 + c)) } fn output(ans: u8) -> u8 { ans }