import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=  new StringTokenizer(reader.readLine());
        int n = Integer.parseInt(st.nextToken());
        int m = Integer.parseInt(st.nextToken());
        int num=0;
        if (n > 0) {
            num += n * (n-1)/2;
        } if (m > 0) {
            num +=m * (m-1)/2;
        }
        System.out.println(num);
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.StringTokenizer; StringTokenizer java.util public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=  new StringTokenizer(reader.readLine());
        int n = Integer.parseInt(st.nextToken());
        int m = Integer.parseInt(st.nextToken());
        int num=0;
        if (n > 0) {
            num += n * (n-1)/2;
        } if (m > 0) {
            num +=m * (m-1)/2;
        }
        System.out.println(num);
    }
} Main public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=  new StringTokenizer(reader.readLine());
        int n = Integer.parseInt(st.nextToken());
        int m = Integer.parseInt(st.nextToken());
        int num=0;
        if (n > 0) {
            num += n * (n-1)/2;
        } if (m > 0) {
            num +=m * (m-1)/2;
        }
        System.out.println(num);
    } main {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=  new StringTokenizer(reader.readLine());
        int n = Integer.parseInt(st.nextToken());
        int m = Integer.parseInt(st.nextToken());
        int num=0;
        if (n > 0) {
            num += n * (n-1)/2;
        } if (m > 0) {
            num +=m * (m-1)/2;
        }
        System.out.println(num);
    } BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); reader new BufferedReader(new InputStreamReader(System.in)) StringTokenizer st=  new StringTokenizer(reader.readLine()); st new StringTokenizer(reader.readLine()) int n = Integer.parseInt(st.nextToken()); n Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st int m = Integer.parseInt(st.nextToken()); m Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st int num=0; num 0 if (n > 0) {
            num += n * (n-1)/2;
        } n > 0 n 0 {
            num += n * (n-1)/2;
        } num += n * (n-1)/2 num n * (n-1)/2 n * (n-1) n (n-1) n 1 2 if (m > 0) {
            num +=m * (m-1)/2;
        } m > 0 m 0 {
            num +=m * (m-1)/2;
        } num +=m * (m-1)/2 num m * (m-1)/2 m * (m-1) m (m-1) m 1 2 System.out.println(num) System.out.println System.out System System.out num String[] args args public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=  new StringTokenizer(reader.readLine());
        int n = Integer.parseInt(st.nextToken());
        int m = Integer.parseInt(st.nextToken());
        int num=0;
        if (n > 0) {
            num += n * (n-1)/2;
        } if (m > 0) {
            num +=m * (m-1)/2;
        }
        System.out.println(num);
    }
} public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=  new StringTokenizer(reader.readLine());
        int n = Integer.parseInt(st.nextToken());
        int m = Integer.parseInt(st.nextToken());
        int num=0;
        if (n > 0) {
            num += n * (n-1)/2;
        } if (m > 0) {
            num +=m * (m-1)/2;
        }
        System.out.println(num);
    }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=  new StringTokenizer(reader.readLine());
        int n = Integer.parseInt(st.nextToken());
        int m = Integer.parseInt(st.nextToken());
        int num=0;
        if (n > 0) {
            num += n * (n-1)/2;
        } if (m > 0) {
            num +=m * (m-1)/2;
        }
        System.out.println(num);
    }
}
