import java.math.BigInteger
fun main(args: Array<String>) {
    tailrec fun fact(n: BigInteger, total: BigInteger = BigInteger.ONE): BigInteger {
        if (n <= BigInteger.ONE) {
            return total
        }
        return fact(n.subtract(BigInteger.ONE), total * n)
    }

    val values = readLine()?.split(' ') ?: return
    if (values.size != 2) {
        return
    }
    val n = values[0].toLong()
    val m = values[1].toLong()

    // n, mの組み合わせの数を足す
    // n! / r!(n-r)!
    val nCount = if (n - 2 >= 0) {
        fact(BigInteger.valueOf(n)) / (fact(BigInteger.valueOf(2)) * fact(BigInteger.valueOf(n - 2)))
    } else {
        BigInteger.ZERO
    }
    val mCount = if (m - 2 >= 0) {
        fact(BigInteger.valueOf(m)) / (fact(BigInteger.valueOf(2)) * fact(BigInteger.valueOf(m - 2)))
    } else {
        BigInteger.ZERO
    }
    println((nCount + mCount).toInt())
}
