import java.util.*;
import java.io.BufferedReader; 
import java.io.IOException; 
import java.io.InputStreamReader; 

public class Main{

    static int comb(int m,int n)
    {
        int res=1;

        if(n>m-n)
            n=m-n;

        for(int i=0;i<n;i++)
        {
            res*=(m-i);
            res/=(i+1);
        }
        return res;
    }
    public static void main(String[] args) {
        
        Scanner in = new Scanner(System.in);

        int m= in.nextInt();
        int n = in.nextInt();

        int total_ways=0;

        if(m>=2)
            total_ways+=comb(m,2);

        if(n>=2)
            total_ways+=comb(n,2);

        System.out.println(total_ways);
    }
} import java.util.*; util.* java import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main{

    static int comb(int m,int n)
    {
        int res=1;

        if(n>m-n)
            n=m-n;

        for(int i=0;i<n;i++)
        {
            res*=(m-i);
            res/=(i+1);
        }
        return res;
    }
    public static void main(String[] args) {
        
        Scanner in = new Scanner(System.in);

        int m= in.nextInt();
        int n = in.nextInt();

        int total_ways=0;

        if(m>=2)
            total_ways+=comb(m,2);

        if(n>=2)
            total_ways+=comb(n,2);

        System.out.println(total_ways);
    }
} Main static int comb(int m,int n)
    {
        int res=1;

        if(n>m-n)
            n=m-n;

        for(int i=0;i<n;i++)
        {
            res*=(m-i);
            res/=(i+1);
        }
        return res;
    } comb {
        int res=1;

        if(n>m-n)
            n=m-n;

        for(int i=0;i<n;i++)
        {
            res*=(m-i);
            res/=(i+1);
        }
        return res;
    } int res=1; res 1 if(n>m-n)
            n=m-n; n>m-n n m-n m n n=m-n n m-n m n for(int i=0;i<n;i++)
        {
            res*=(m-i);
            res/=(i+1);
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            res*=(m-i);
            res/=(i+1);
        } {
            res*=(m-i);
            res/=(i+1);
        } res*=(m-i) res (m-i) m i res/=(i+1) res (i+1) i 1 return res; res int m m int n n public static void main(String[] args) {
        
        Scanner in = new Scanner(System.in);

        int m= in.nextInt();
        int n = in.nextInt();

        int total_ways=0;

        if(m>=2)
            total_ways+=comb(m,2);

        if(n>=2)
            total_ways+=comb(n,2);

        System.out.println(total_ways);
    } main {
        
        Scanner in = new Scanner(System.in);

        int m= in.nextInt();
        int n = in.nextInt();

        int total_ways=0;

        if(m>=2)
            total_ways+=comb(m,2);

        if(n>=2)
            total_ways+=comb(n,2);

        System.out.println(total_ways);
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) int m= in.nextInt(); m in.nextInt() in.nextInt in int n = in.nextInt(); n in.nextInt() in.nextInt in int total_ways=0; total_ways 0 if(m>=2)
            total_ways+=comb(m,2); m>=2 m 2 total_ways+=comb(m,2) total_ways comb(m,2) comb m 2 if(n>=2)
            total_ways+=comb(n,2); n>=2 n 2 total_ways+=comb(n,2) total_ways comb(n,2) comb n 2 System.out.println(total_ways) System.out.println System.out System System.out total_ways String[] args args public class Main{

    static int comb(int m,int n)
    {
        int res=1;

        if(n>m-n)
            n=m-n;

        for(int i=0;i<n;i++)
        {
            res*=(m-i);
            res/=(i+1);
        }
        return res;
    }
    public static void main(String[] args) {
        
        Scanner in = new Scanner(System.in);

        int m= in.nextInt();
        int n = in.nextInt();

        int total_ways=0;

        if(m>=2)
            total_ways+=comb(m,2);

        if(n>=2)
            total_ways+=comb(n,2);

        System.out.println(total_ways);
    }
} public class Main{

    static int comb(int m,int n)
    {
        int res=1;

        if(n>m-n)
            n=m-n;

        for(int i=0;i<n;i++)
        {
            res*=(m-i);
            res/=(i+1);
        }
        return res;
    }
    public static void main(String[] args) {
        
        Scanner in = new Scanner(System.in);

        int m= in.nextInt();
        int n = in.nextInt();

        int total_ways=0;

        if(m>=2)
            total_ways+=comb(m,2);

        if(n>=2)
            total_ways+=comb(n,2);

        System.out.println(total_ways);
    }
} Main
import java.util.*;
import java.io.BufferedReader; 
import java.io.IOException; 
import java.io.InputStreamReader; 

public class Main{

    static int comb(int m,int n)
    {
        int res=1;

        if(n>m-n)
            n=m-n;

        for(int i=0;i<n;i++)
        {
            res*=(m-i);
            res/=(i+1);
        }
        return res;
    }
    public static void main(String[] args) {
        
        Scanner in = new Scanner(System.in);

        int m= in.nextInt();
        int n = in.nextInt();

        int total_ways=0;

        if(m>=2)
            total_ways+=comb(m,2);

        if(n>=2)
            total_ways+=comb(n,2);

        System.out.println(total_ways);
    }
}
