import java.util.Scanner;

public class Main{
    
 
    public static void main(String[] args)  {
        new Main().solve();
    }

    void solve(){
        Scanner sc = new Scanner(System.in);
        int N,M;
        N = Integer.parseInt(sc.next());
        M = Integer.parseInt(sc.next());
        sc.close();

        int result;

        if(N==0){
            if(M==0){
                result = 0;
            }
            result = M*(M-1)/2;
        }
        else{
            result = N*(N-1)/2 + M*(M-1)/2;
        }
        
        System.out.println(result);

        

    }
} import java.util.Scanner; Scanner java.util public class Main{
    
 
    public static void main(String[] args)  {
        new Main().solve();
    }

    void solve(){
        Scanner sc = new Scanner(System.in);
        int N,M;
        N = Integer.parseInt(sc.next());
        M = Integer.parseInt(sc.next());
        sc.close();

        int result;

        if(N==0){
            if(M==0){
                result = 0;
            }
            result = M*(M-1)/2;
        }
        else{
            result = N*(N-1)/2 + M*(M-1)/2;
        }
        
        System.out.println(result);

        

    }
} Main public static void main(String[] args)  {
        new Main().solve();
    } main {
        new Main().solve();
    } new Main().solve() new Main().solve new Main() String[] args args void solve(){
        Scanner sc = new Scanner(System.in);
        int N,M;
        N = Integer.parseInt(sc.next());
        M = Integer.parseInt(sc.next());
        sc.close();

        int result;

        if(N==0){
            if(M==0){
                result = 0;
            }
            result = M*(M-1)/2;
        }
        else{
            result = N*(N-1)/2 + M*(M-1)/2;
        }
        
        System.out.println(result);

        

    } solve {
        Scanner sc = new Scanner(System.in);
        int N,M;
        N = Integer.parseInt(sc.next());
        M = Integer.parseInt(sc.next());
        sc.close();

        int result;

        if(N==0){
            if(M==0){
                result = 0;
            }
            result = M*(M-1)/2;
        }
        else{
            result = N*(N-1)/2 + M*(M-1)/2;
        }
        
        System.out.println(result);

        

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N N M; M N = Integer.parseInt(sc.next()) N Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc M = Integer.parseInt(sc.next()) M Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc sc.close() sc.close sc int result; result if(N==0){
            if(M==0){
                result = 0;
            }
            result = M*(M-1)/2;
        }
        else{
            result = N*(N-1)/2 + M*(M-1)/2;
        } N==0 N 0 {
            if(M==0){
                result = 0;
            }
            result = M*(M-1)/2;
        } if(M==0){
                result = 0;
            } M==0 M 0 {
                result = 0;
            } result = 0 result 0 result = M*(M-1)/2 result M*(M-1)/2 M*(M-1) M (M-1) M 1 2 {
            result = N*(N-1)/2 + M*(M-1)/2;
        } result = N*(N-1)/2 + M*(M-1)/2 result 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(result) System.out.println System.out System System.out result public class Main{
    
 
    public static void main(String[] args)  {
        new Main().solve();
    }

    void solve(){
        Scanner sc = new Scanner(System.in);
        int N,M;
        N = Integer.parseInt(sc.next());
        M = Integer.parseInt(sc.next());
        sc.close();

        int result;

        if(N==0){
            if(M==0){
                result = 0;
            }
            result = M*(M-1)/2;
        }
        else{
            result = N*(N-1)/2 + M*(M-1)/2;
        }
        
        System.out.println(result);

        

    }
} public class Main{
    
 
    public static void main(String[] args)  {
        new Main().solve();
    }

    void solve(){
        Scanner sc = new Scanner(System.in);
        int N,M;
        N = Integer.parseInt(sc.next());
        M = Integer.parseInt(sc.next());
        sc.close();

        int result;

        if(N==0){
            if(M==0){
                result = 0;
            }
            result = M*(M-1)/2;
        }
        else{
            result = N*(N-1)/2 + M*(M-1)/2;
        }
        
        System.out.println(result);

        

    }
} Main
import java.util.Scanner;

public class Main{
    
 
    public static void main(String[] args)  {
        new Main().solve();
    }

    void solve(){
        Scanner sc = new Scanner(System.in);
        int N,M;
        N = Integer.parseInt(sc.next());
        M = Integer.parseInt(sc.next());
        sc.close();

        int result;

        if(N==0){
            if(M==0){
                result = 0;
            }
            result = M*(M-1)/2;
        }
        else{
            result = N*(N-1)/2 + M*(M-1)/2;
        }
        
        System.out.println(result);

        

    }
}