https://www.acmicpc.net/problem/10707
import java.util.*
fun main(args: Array<String>) {
val s=Scanner(System.`in`)
var a=s.nextInt()
var b=s.nextInt()
var c=s.nextInt()
var d=s.nextInt()
var p=s.nextInt()
var sum=p*a
var sum1:Int
if(p<=c) sum1=b
else sum1=b+(p-c)*d
print(Math.min(sum,sum1))
}