import java.io.InputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();
		int M = sc.nextInt();

		sc.close();

		long ans = 0;

		if (N >= 2) {
			ans += (N * (N - 1)) / 2;
		}

		if (M >= 2) {
			ans += (M * (M - 1)) / 2;
		}

		out.println(ans);

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}
} import java.io.InputStream; InputStream java.io import java.io.PrintStream; PrintStream java.io import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();
		int M = sc.nextInt();

		sc.close();

		long ans = 0;

		if (N >= 2) {
			ans += (N * (N - 1)) / 2;
		}

		if (M >= 2) {
			ans += (M * (M - 1)) / 2;
		}

		out.println(ans);

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}
} Main InputStream in = System.in; in System.in System System.in PrintStream out = System.out; out System.out System System.out public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();
		int M = sc.nextInt();

		sc.close();

		long ans = 0;

		if (N >= 2) {
			ans += (N * (N - 1)) / 2;
		}

		if (M >= 2) {
			ans += (M * (M - 1)) / 2;
		}

		out.println(ans);

	} _main {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();
		int M = sc.nextInt();

		sc.close();

		long ans = 0;

		if (N >= 2) {
			ans += (N * (N - 1)) / 2;
		}

		if (M >= 2) {
			ans += (M * (M - 1)) / 2;
		}

		out.println(ans);

	} Scanner sc = new Scanner(in); sc new Scanner(in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int M = sc.nextInt(); M sc.nextInt() sc.nextInt sc sc.close() sc.close sc long ans = 0; ans 0 if (N >= 2) {
			ans += (N * (N - 1)) / 2;
		} N >= 2 N 2 {
			ans += (N * (N - 1)) / 2;
		} ans += (N * (N - 1)) / 2 ans (N * (N - 1)) / 2 (N * (N - 1)) N (N - 1) N 1 2 if (M >= 2) {
			ans += (M * (M - 1)) / 2;
		} M >= 2 M 2 {
			ans += (M * (M - 1)) / 2;
		} ans += (M * (M - 1)) / 2 ans (M * (M - 1)) / 2 (M * (M - 1)) M (M - 1) M 1 2 out.println(ans) out.println out ans String[] args args public static void main(String[] args) {
		new Main()._main(args);
	} main {
		new Main()._main(args);
	} new Main()._main(args) new Main()._main new Main() args String[] args args public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();
		int M = sc.nextInt();

		sc.close();

		long ans = 0;

		if (N >= 2) {
			ans += (N * (N - 1)) / 2;
		}

		if (M >= 2) {
			ans += (M * (M - 1)) / 2;
		}

		out.println(ans);

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}
} public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();
		int M = sc.nextInt();

		sc.close();

		long ans = 0;

		if (N >= 2) {
			ans += (N * (N - 1)) / 2;
		}

		if (M >= 2) {
			ans += (M * (M - 1)) / 2;
		}

		out.println(ans);

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}
} Main
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();
		int M = sc.nextInt();

		sc.close();

		long ans = 0;

		if (N >= 2) {
			ans += (N * (N - 1)) / 2;
		}

		if (M >= 2) {
			ans += (M * (M - 1)) / 2;
		}

		out.println(ans);

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}
}
