
fun main(args:Array<String>) {
    val inpt = readLine()!!.split(" ").map { it.toInt() }
    val prc = Proc(inpt[0], inpt[1], inpt[2], inpt[3], inpt[4])
    println(prc.proc())
}


class Proc(val a:Int, val b:Int, val c:Int, val x:Int, val y:Int) {
    fun proc():Int {
        return getAns(0, Math.max(x,y)*2)
    }

    fun getCost(mixCount:Int):Int {
        var ret = mixCount*c
        ret += Math.max(x - (mixCount/2), 0)*a
        ret += Math.max(y - (mixCount/2), 0)*b
        return ret
    }
    fun getAns(min:Int, max:Int):Int {
        if(max-min <= 2) {
            return listOf(min, (max+min)/2, max).map { getCost(it) }.min()!!
        }
        val idx1 = min + (max-min)/3
        val idx2 = idx1 + (max-min)/3
        val val1 = getCost(min)
        val val2 = getCost(idx1)
        val val3 = getCost(idx2)
        val val4 = getCost(max)
        val minVal = listOf(val1,val2,val3,val4).min()!!
        if(val1 == minVal) {
            return getAns(min, idx1)
        } else if(val2 == minVal) {
            return getAns(min, idx2)
        } else if(val3 == minVal) {
            return getAns(idx1, max)
        } else {
            return getAns(idx2, max)
        }
    }

}
