import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

        String input_line[] = sc.nextLine().split(" ");
        int N=Integer.parseInt(input_line[0]);
        int M=Integer.parseInt(input_line[1]);
        int sum=0;
        sum=N*(N-1)/2+M*(M-1)/2;
        System.out.print(sum);
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

        String input_line[] = sc.nextLine().split(" ");
        int N=Integer.parseInt(input_line[0]);
        int M=Integer.parseInt(input_line[1]);
        int sum=0;
        sum=N*(N-1)/2+M*(M-1)/2;
        System.out.print(sum);
	}

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

        String input_line[] = sc.nextLine().split(" ");
        int N=Integer.parseInt(input_line[0]);
        int M=Integer.parseInt(input_line[1]);
        int sum=0;
        sum=N*(N-1)/2+M*(M-1)/2;
        System.out.print(sum);
	} main {
		Scanner sc = new Scanner(System.in);

        String input_line[] = sc.nextLine().split(" ");
        int N=Integer.parseInt(input_line[0]);
        int M=Integer.parseInt(input_line[1]);
        int sum=0;
        sum=N*(N-1)/2+M*(M-1)/2;
        System.out.print(sum);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String input_line[] = sc.nextLine().split(" "); input_line sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " int N=Integer.parseInt(input_line[0]); N Integer.parseInt(input_line[0]) Integer.parseInt Integer input_line[0] input_line 0 int M=Integer.parseInt(input_line[1]); M Integer.parseInt(input_line[1]) Integer.parseInt Integer input_line[1] input_line 1 int sum=0; sum 0 sum=N*(N-1)/2+M*(M-1)/2 sum 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.print(sum) System.out.print System.out System System.out sum String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

        String input_line[] = sc.nextLine().split(" ");
        int N=Integer.parseInt(input_line[0]);
        int M=Integer.parseInt(input_line[1]);
        int sum=0;
        sum=N*(N-1)/2+M*(M-1)/2;
        System.out.print(sum);
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

        String input_line[] = sc.nextLine().split(" ");
        int N=Integer.parseInt(input_line[0]);
        int M=Integer.parseInt(input_line[1]);
        int sum=0;
        sum=N*(N-1)/2+M*(M-1)/2;
        System.out.print(sum);
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

        String input_line[] = sc.nextLine().split(" ");
        int N=Integer.parseInt(input_line[0]);
        int M=Integer.parseInt(input_line[1]);
        int sum=0;
        sum=N*(N-1)/2+M*(M-1)/2;
        System.out.print(sum);
	}

}