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

    println(comb(n, 2) + comb(m, 2))
}

fun perm(n: Int, k: Int): Long {
    return (n - k + 1 .. n).fold(1L) { acc, i -> acc * i }
}

fun comb(n: Int, k: Int): Long {
    if (n == 0) return 0
    val fact = (2..k).fold(1L) { acc, i -> acc * i }
    return perm(n, k) / fact
}
