
object Main extends App {
  import scala.io.StdIn._
  val Array(n, a, b, c, d) = readLine.trim.split(' ').map(_.toInt)
  val buyX = (n.toDouble / a).ceil.toInt * b
  val buyY = (n.toDouble / c).ceil.toInt * d
  println(List(buyX, buyY).min)
}
