(* O(1) *)
Scanf.scanf " %d %d %d %d %d" @@ fun a b c x y ->
  let both = min x y in
  let d, z = if x > y then a, x - both else b, y - both in
  both * min (a + b) (2 * c) + z * min d (2 * c) |> Printf.printf "%d\n"