fun main(args: Array<String>) {
    val (A, B, C, X, Y) = readLine()!!.split(" ").map { it.toLong() }

    //

    // assume buying C * 2i
    var sum = X * A + Y * B
    var min = sum
    var a = X
    var b = Y
    var c = 0L
    while (!(a == 0L && b == 0L)) {
        if (a > 0) {
            sum = sum - A
            a--
        }

        if (b > 0) {
            sum = sum - B
            b--
        }
        c += 2
        sum = sum + C * 2
        min = Math.min(min, sum)
    }
    println(min)
}
