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