fun main (args : Array<String>) {
    val (n, m) = readLine()!!.split(" ")
    val N : Int = n.toInt()
    val M : Int = m.toInt()

    var result : Int = 0

    if (N > 1) {
        for (i in 1..N - 1) {
            result += i
        }
    }

    if (M > 1) {
        for (i in 1..M - 1) {
            result += i
        }
    }

    println("${result}")

}