import java.util.*;

public class Main{
    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int M = scanner.nextInt();

        int res = 0;
        if(N > 0) {
            res += N * (N-1) / 2;
        }
        if(M > 0){
            res += M * (M-1) / 2;
        }
        System.out.println(res);
    }
} import java.util.*; util.* java public class Main{
    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int M = scanner.nextInt();

        int res = 0;
        if(N > 0) {
            res += N * (N-1) / 2;
        }
        if(M > 0){
            res += M * (M-1) / 2;
        }
        System.out.println(res);
    }
} Main public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int M = scanner.nextInt();

        int res = 0;
        if(N > 0) {
            res += N * (N-1) / 2;
        }
        if(M > 0){
            res += M * (M-1) / 2;
        }
        System.out.println(res);
    } main {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int M = scanner.nextInt();

        int res = 0;
        if(N > 0) {
            res += N * (N-1) / 2;
        }
        if(M > 0){
            res += M * (M-1) / 2;
        }
        System.out.println(res);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int N = scanner.nextInt(); N scanner.nextInt() scanner.nextInt scanner int M = scanner.nextInt(); M scanner.nextInt() scanner.nextInt scanner int res = 0; res 0 if(N > 0) {
            res += N * (N-1) / 2;
        } N > 0 N 0 {
            res += N * (N-1) / 2;
        } res += N * (N-1) / 2 res N * (N-1) / 2 N * (N-1) N (N-1) N 1 2 if(M > 0){
            res += M * (M-1) / 2;
        } M > 0 M 0 {
            res += M * (M-1) / 2;
        } res += M * (M-1) / 2 res M * (M-1) / 2 M * (M-1) M (M-1) M 1 2 System.out.println(res) System.out.println System.out System System.out res String args[] args public class Main{
    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int M = scanner.nextInt();

        int res = 0;
        if(N > 0) {
            res += N * (N-1) / 2;
        }
        if(M > 0){
            res += M * (M-1) / 2;
        }
        System.out.println(res);
    }
} public class Main{
    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int M = scanner.nextInt();

        int res = 0;
        if(N > 0) {
            res += N * (N-1) / 2;
        }
        if(M > 0){
            res += M * (M-1) / 2;
        }
        System.out.println(res);
    }
} Main
import java.util.*;

public class Main{
    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int M = scanner.nextInt();

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