import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)
  val n, a, b, c, d = sc.nextInt()
  val x = (n + a - 1) / a * b
  val y = (n + c - 1) / c * d
  println(math.min(x, y))
}

