fun main(args: Array) { val (a,b,c,d,e) = readLine()!!.split(" ").map { it.toInt() } val candyCount = (b-c)*a val candy = mutableListOf() if(candyCount > 0) { candy.add(d) for(i in (2..candyCount)) { if(i % 10 == 0) { candy.add(candy.last()) } else if(e <= candy.last()) { candy.add(candy.last() - e) } else { candy.add(candy.last()) } } } println(candy.sum()) }