const input = require("fs").readFileSync("/dev/stdin", "utf8")

const lines = input.split('\n')
const [N, M] = lines[0].split(' ').map(Number)

const f = (n) => {
  let sum = 0
  for (let i = 1; i <= n; i++) {
    sum += i
  }
  return sum
}

console.log(f(N - 1) + f(M - 1))