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

class Main{
    public static void main(String args[])throws IOException{
        try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))){
            String[] input = br.readLine().split(" ");
            int N = Integer.parseInt(input[0]);
            int M = Integer.parseInt(input[1]);

            int result = 0;

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

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

            System.out.println(result);
        }
   
    }
} import java.util.*; util.* java import java.io.*; io.* java class Main{
    public static void main(String args[])throws IOException{
        try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))){
            String[] input = br.readLine().split(" ");
            int N = Integer.parseInt(input[0]);
            int M = Integer.parseInt(input[1]);

            int result = 0;

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

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

            System.out.println(result);
        }
   
    }
} Main public static void main(String args[])throws IOException{
        try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))){
            String[] input = br.readLine().split(" ");
            int N = Integer.parseInt(input[0]);
            int M = Integer.parseInt(input[1]);

            int result = 0;

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

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

            System.out.println(result);
        }
   
    } main {
        try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))){
            String[] input = br.readLine().split(" ");
            int N = Integer.parseInt(input[0]);
            int M = Integer.parseInt(input[1]);

            int result = 0;

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

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

            System.out.println(result);
        }
   
    } try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))){
            String[] input = br.readLine().split(" ");
            int N = Integer.parseInt(input[0]);
            int M = Integer.parseInt(input[1]);

            int result = 0;

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

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

            System.out.println(result);
        } {
            String[] input = br.readLine().split(" ");
            int N = Integer.parseInt(input[0]);
            int M = Integer.parseInt(input[1]);

            int result = 0;

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

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

            System.out.println(result);
        } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)) BufferedReader br = new BufferedReader(new InputStreamReader(System.in)) new BufferedReader(new InputStreamReader(System.in)) String[] input = br.readLine().split(" "); input br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int N = Integer.parseInt(input[0]); N Integer.parseInt(input[0]) Integer.parseInt Integer input[0] input 0 int M = Integer.parseInt(input[1]); M Integer.parseInt(input[1]) Integer.parseInt Integer input[1] input 1 int result = 0; result 0 if(N > 1){
              result += (N*(N-1))/2;
            } N > 1 N 1 {
              result += (N*(N-1))/2;
            } result += (N*(N-1))/2 result (N*(N-1))/2 (N*(N-1)) N (N-1) N 1 2 if(M > 1){
              result += (M*(M-1))/2;
            } M > 1 M 1 {
              result += (M*(M-1))/2;
            } result += (M*(M-1))/2 result (M*(M-1))/2 (M*(M-1)) M (M-1) M 1 2 System.out.println(result) System.out.println System.out System System.out result String args[] args
import java.util.*;
import java.io.*;

class Main{
    public static void main(String args[])throws IOException{
        try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))){
            String[] input = br.readLine().split(" ");
            int N = Integer.parseInt(input[0]);
            int M = Integer.parseInt(input[1]);

            int result = 0;

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

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

            System.out.println(result);
        }
   
    }
}