fun main(args: Array<String>) {
    val (n, l) = readLine()!!.split(' ').map { it.toInt() }
    val apples = (0 until n).map { l + it }.sortedBy { Math.abs(it) }
    println(apples.sum() - apples.first())
}