fn main() { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); let v: Vec = s.split_whitespace().flat_map(str::parse).collect(); let (mut t, mut n, mut b, mut m) = (i64::MIN, 0, i64::MAX, 0); for x in v[4]..=v[5] { let h = ((v[0] * x + v[1]) * x + v[2]) * x + v[3]; if h > t { (t, n) = (h, x); } if h < b { (b, m) = (h, x); } } println!("{t} {n} {b} {m}") }