import java.io.*;
 
public class Main {
 
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine();
		String[] info = line.split(" ");
		int N = Integer.parseInt(info[0]);
		int M = Integer.parseInt(info[1]);
		
		System.out.println(N*(N-1)/2 + M*(M-1)/2);
	}
} import java.io.*; io.* java public class Main {
 
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine();
		String[] info = line.split(" ");
		int N = Integer.parseInt(info[0]);
		int M = Integer.parseInt(info[1]);
		
		System.out.println(N*(N-1)/2 + M*(M-1)/2);
	}
} Main public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine();
		String[] info = line.split(" ");
		int N = Integer.parseInt(info[0]);
		int M = Integer.parseInt(info[1]);
		
		System.out.println(N*(N-1)/2 + M*(M-1)/2);
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine();
		String[] info = line.split(" ");
		int N = Integer.parseInt(info[0]);
		int M = Integer.parseInt(info[1]);
		
		System.out.println(N*(N-1)/2 + M*(M-1)/2);
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String line = br.readLine(); line br.readLine() br.readLine br String[] info = line.split(" "); info line.split(" ") line.split line " " int N = Integer.parseInt(info[0]); N Integer.parseInt(info[0]) Integer.parseInt Integer info[0] info 0 int M = Integer.parseInt(info[1]); M Integer.parseInt(info[1]) Integer.parseInt Integer info[1] info 1 System.out.println(N*(N-1)/2 + M*(M-1)/2) System.out.println System.out System System.out 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 String[] args args public class Main {
 
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine();
		String[] info = line.split(" ");
		int N = Integer.parseInt(info[0]);
		int M = Integer.parseInt(info[1]);
		
		System.out.println(N*(N-1)/2 + M*(M-1)/2);
	}
} public class Main {
 
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine();
		String[] info = line.split(" ");
		int N = Integer.parseInt(info[0]);
		int M = Integer.parseInt(info[1]);
		
		System.out.println(N*(N-1)/2 + M*(M-1)/2);
	}
} Main
import java.io.*;
 
public class Main {
 
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine();
		String[] info = line.split(" ");
		int N = Integer.parseInt(info[0]);
		int M = Integer.parseInt(info[1]);
		
		System.out.println(N*(N-1)/2 + M*(M-1)/2);
	}
}