(defn create-data [s]
  (map #(Long/parseLong %) (.split s " ")))

(defn pizza [[a b c x y] z]
  (->>
   (+ (* a (max 0 (- x z)))
      (* b (max 0(- y z)))
      (* 2 c z))))

(defn halfAndHalf [[a b c x y]]
  (->>
   (for [i (range (max (inc x) (inc y)))
         :let [onedan ((partial pizza [a b c x y]) i)]]
     onedan)
   (apply min)
   ))

(println (halfAndHalf (create-data (read-line))))
