fun main(args: Array<String>) {
    val n = readLine().orEmpty()?.toInt()
    val k = readLine().orEmpty()?.toInt()
    val x = readLine().orEmpty()?.toInt()
    val y = readLine().orEmpty()?.toInt()
    var price = 0


    price = if(n <= k){
        x * n
    }else {
        x * k + (y * (n - k))
    }
    println(price)

}
