let () =
  Scanf.scanf "%d %d %d %d %d" @@ fun a b c x y ->
  let m = min x y in
  let p1 = min (a+b) (2*c) * m
  and p2 = min a (2*c) * (x-m)
  and p3 = min b (2*c) * (y-m)
  in Printf.printf "%d\n" (p1+p2+p3)