let [| a; b; c; d; p; q |] = stdin.ReadLine().Split() |> Array.map int let calc x = a * (pown x 3) + b * x * x + c * x + d let ys = [ p..q ] |> List.map calc let mutable high = 0 let mutable low = 0 for i in 0..q - p do let y = ys.[i] if y > ys.[high] then high <- i if y < ys.[low] then low <- i [| ys.[high] high + p ys.[low] low + p |] |> Array.map string |> String.concat " " |> printfn "%s"