fun main(args: Array<String>) {
    val numList = readLine()?.split(" ").orEmpty()

    val numN = numList[0].toInt()
    val numM = numList[1].toInt()

    var resultN = 0
    var resultM = 0
    
    if(numN > 2){
        var denomN = 1
        for(i in numN - 2 .. 2){
            denomN *= i
        }
        var numerN = denomN * numN * (numN - 1)
        resultN = numerN / (denomN * 2)
    }else if(numN == 2){
        resultN = 1
    }

    if(numM > 2){
        var denomM = 1

        for(i in numM - 2 .. 2){
            denomM *= i
        }
        var numerM = denomM * numM * (numM - 1)
        resultM = numerM / (denomM * 2)
    }else if(numM == 2){
        resultM = 1
    }

    println(resultN + resultM)

}

