package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {

	// input
	params := inputLineAsNumArray(5)
	pA := uint(params[0])
	pB := uint(params[1])
	pAB := uint(params[2])
	rA := uint(params[3])
	rB := uint(params[4])

	var a, b, ab uint
	//created
	cA := uint(0)
	cB := uint(0)

	sum := uint(0)
	if pAB < (pA+pB)/2 {
		min := min(rA, rB)
		sum += min * 2 * pAB
		cA += min
		cB += min

		ab += min * 2
	}

	if 2*pAB < pA {
		toCreate := (rA - cA)
		sum += toCreate * 2 * pAB
		cA += toCreate
		cB += toCreate

		ab += toCreate * 2
	}

	if 2*pAB < pB {
		toCreate := (rB - cB)
		sum += toCreate * 2 * pAB
		cA += toCreate
		cB += toCreate

		ab += toCreate * 2
	}

	if (rA - cA) > 0 {
		toCreate := (rA - cA)
		sum += toCreate * pA

		a += toCreate
	}

	if (rB - cB) > 0 {

		toCreate := (rB - cB)
		sum += toCreate * pB

		b += toCreate
	}

	fmt.Println(sum)
}

func min(x, y uint) uint {
	if x <= y {
		return x
	} else {
		return y
	}
}

func max(x, y uint) uint {
	if x >= y {
		return x
	} else {
		return y
	}
}

func inputLineAsNumArray(length int) []int {

	line := strings.Split(readLine(), " ")
	var nums []int
	for i := 0; i < length; i++ {
		num, _ := strconv.Atoi(line[i])
		nums = append(nums, num)
	}
	return nums
}

func readLine() string {

	sc.Scan()
	return sc.Text()
}
