import java.util.Scanner;

public class Main {
	public static void main (String[] args) {
		int N;
		int M;
		Scanner scan = new Scanner(System.in);
		String num = scan.nextLine();
		String[] numbers = num.split(" ");
		N = Integer.parseInt(numbers[0]);
		M = Integer.parseInt(numbers[1]);

		int c = (N*(N-1))/2 + (M*(M-1))/2;
		System.out.println(c);
		
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main (String[] args) {
		int N;
		int M;
		Scanner scan = new Scanner(System.in);
		String num = scan.nextLine();
		String[] numbers = num.split(" ");
		N = Integer.parseInt(numbers[0]);
		M = Integer.parseInt(numbers[1]);

		int c = (N*(N-1))/2 + (M*(M-1))/2;
		System.out.println(c);
		
	}
} Main public static void main (String[] args) {
		int N;
		int M;
		Scanner scan = new Scanner(System.in);
		String num = scan.nextLine();
		String[] numbers = num.split(" ");
		N = Integer.parseInt(numbers[0]);
		M = Integer.parseInt(numbers[1]);

		int c = (N*(N-1))/2 + (M*(M-1))/2;
		System.out.println(c);
		
	} main {
		int N;
		int M;
		Scanner scan = new Scanner(System.in);
		String num = scan.nextLine();
		String[] numbers = num.split(" ");
		N = Integer.parseInt(numbers[0]);
		M = Integer.parseInt(numbers[1]);

		int c = (N*(N-1))/2 + (M*(M-1))/2;
		System.out.println(c);
		
	} int N; N int M; M Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String num = scan.nextLine(); num scan.nextLine() scan.nextLine scan String[] numbers = num.split(" "); numbers num.split(" ") num.split num " " N = Integer.parseInt(numbers[0]) N Integer.parseInt(numbers[0]) Integer.parseInt Integer numbers[0] numbers 0 M = Integer.parseInt(numbers[1]) M Integer.parseInt(numbers[1]) Integer.parseInt Integer numbers[1] numbers 1 int c = (N*(N-1))/2 + (M*(M-1))/2; c (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 System.out.println(c) System.out.println System.out System System.out c String[] args args public class Main {
	public static void main (String[] args) {
		int N;
		int M;
		Scanner scan = new Scanner(System.in);
		String num = scan.nextLine();
		String[] numbers = num.split(" ");
		N = Integer.parseInt(numbers[0]);
		M = Integer.parseInt(numbers[1]);

		int c = (N*(N-1))/2 + (M*(M-1))/2;
		System.out.println(c);
		
	}
} public class Main {
	public static void main (String[] args) {
		int N;
		int M;
		Scanner scan = new Scanner(System.in);
		String num = scan.nextLine();
		String[] numbers = num.split(" ");
		N = Integer.parseInt(numbers[0]);
		M = Integer.parseInt(numbers[1]);

		int c = (N*(N-1))/2 + (M*(M-1))/2;
		System.out.println(c);
		
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main (String[] args) {
		int N;
		int M;
		Scanner scan = new Scanner(System.in);
		String num = scan.nextLine();
		String[] numbers = num.split(" ");
		N = Integer.parseInt(numbers[0]);
		M = Integer.parseInt(numbers[1]);

		int c = (N*(N-1))/2 + (M*(M-1))/2;
		System.out.println(c);
		
	}
}