object Main extends App {
  import scala.io.StdIn._
  solve
  def solve: Unit = {
    val a = readLine.trim.toInt
    val b = readLine.trim.toInt
    val c = readLine.trim.toInt
    val d = readLine.trim.toInt
    val e = readLine.trim.toInt
    val kaitoujikan = if (a < 0) -a * c + d else 0
    println(
      kaitoujikan + (if (a < 0) b else b - a) * e
    )
  }
  implicit class ScopeFunc[T](private val value: T) {
    def let[A](func:T ⇒ A): A = func(value)
    def also(func:T ⇒ Unit): T = {
      func(value)
      value
    }
  }
}


