fun main(args: Array<String>) {
    val (countApple, flavor) = readLine()!!.split(" ").map { it.toInt() }

    when {
        flavor <= 0 && Math.abs(flavor) < countApple -> {
            print(calc(countApple, flavor, isEatZero = true))
        }
        else -> {
            print(calc(countApple, flavor, isEatZero = false))
        }
    }
}

fun calc(count: Int, flavor: Int, isEatZero: Boolean): Int {
    return when (isEatZero) {
        true -> calcSequence(flavor, flavor + count - 1, count)
        false -> {
            when {
                flavor >= 0 -> calcSequence(flavor + 1, flavor + count - 1, count - 1)
                else -> calcSequence(flavor, flavor + count - 2, count - 1)
            }
        }
    }
}

fun calcSequence(min: Int, max: Int, count: Int): Int = ((min + max) * count) / 2