import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

int calc(int n, int m) {
    int f(int k) {
        return k * (k - 1) / 2;
    }

    int ans = 0;
    if (n >= 2) ans += f(n);
    if (m >= 2) ans += f(m);
    return ans;
}

void main() {
    int n, m; scan(n, m);
    writeln(calc(n, m));
}

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;
