import java.io.*;
import java.util.*;

public class Main extends PrintWriter {
	Main() { super(System.out, true); }
	Scanner sc = new Scanner(System.in);
	public static void main(String[] $) {
		Main o = new Main(); o.main(); o.flush();
	}

	void main() {
		int n = sc.nextInt();
		int m = sc.nextInt();
		println(n * (n - 1) / 2 + m * (m - 1) / 2);
	}
} import java.io.*; io.* java import java.util.*; util.* java public class Main extends PrintWriter {
	Main() { super(System.out, true); }
	Scanner sc = new Scanner(System.in);
	public static void main(String[] $) {
		Main o = new Main(); o.main(); o.flush();
	}

	void main() {
		int n = sc.nextInt();
		int m = sc.nextInt();
		println(n * (n - 1) / 2 + m * (m - 1) / 2);
	}
} Main Scanner sc = new Scanner(System.in); sc new Scanner(System.in) Main() { super(System.out, true); } Main { super(System.out, true); } super(System.out, true) super System.out System System.out true public static void main(String[] $) {
		Main o = new Main(); o.main(); o.flush();
	} main {
		Main o = new Main(); o.main(); o.flush();
	} Main o = new Main(); o new Main() o.main() o.main o o.flush() o.flush o String[] $ $ void main() {
		int n = sc.nextInt();
		int m = sc.nextInt();
		println(n * (n - 1) / 2 + m * (m - 1) / 2);
	} main {
		int n = sc.nextInt();
		int m = sc.nextInt();
		println(n * (n - 1) / 2 + m * (m - 1) / 2);
	} int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int m = sc.nextInt(); m sc.nextInt() sc.nextInt sc println(n * (n - 1) / 2 + m * (m - 1) / 2) println n * (n - 1) / 2 + m * (m - 1) / 2 n * (n - 1) / 2 n * (n - 1) n (n - 1) n 1 2 m * (m - 1) / 2 m * (m - 1) m (m - 1) m 1 2 PrintWriter public class Main extends PrintWriter {
	Main() { super(System.out, true); }
	Scanner sc = new Scanner(System.in);
	public static void main(String[] $) {
		Main o = new Main(); o.main(); o.flush();
	}

	void main() {
		int n = sc.nextInt();
		int m = sc.nextInt();
		println(n * (n - 1) / 2 + m * (m - 1) / 2);
	}
} public class Main extends PrintWriter {
	Main() { super(System.out, true); }
	Scanner sc = new Scanner(System.in);
	public static void main(String[] $) {
		Main o = new Main(); o.main(); o.flush();
	}

	void main() {
		int n = sc.nextInt();
		int m = sc.nextInt();
		println(n * (n - 1) / 2 + m * (m - 1) / 2);
	}
} Main
import java.io.*;
import java.util.*;

public class Main extends PrintWriter {
	Main() { super(System.out, true); }
	Scanner sc = new Scanner(System.in);
	public static void main(String[] $) {
		Main o = new Main(); o.main(); o.flush();
	}

	void main() {
		int n = sc.nextInt();
		int m = sc.nextInt();
		println(n * (n - 1) / 2 + m * (m - 1) / 2);
	}
}
