import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

//        long start1 = System.currentTimeMillis();
//        long end1 = System.currentTimeMillis();
//        System.out.println("time1: " + (end1 - start1));

        Scanner scanner = new Scanner(System.in);

        String[] inputs = scanner.nextLine().split(" ");

        int n = Integer.parseInt(inputs[0]);
        int m = Integer.parseInt(inputs[1]);

        int result = n * (n - 1) / 2 + m * (m - 1) / 2;

        System.out.println(result);
    }
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {

//        long start1 = System.currentTimeMillis();
//        long end1 = System.currentTimeMillis();
//        System.out.println("time1: " + (end1 - start1));

        Scanner scanner = new Scanner(System.in);

        String[] inputs = scanner.nextLine().split(" ");

        int n = Integer.parseInt(inputs[0]);
        int m = Integer.parseInt(inputs[1]);

        int result = n * (n - 1) / 2 + m * (m - 1) / 2;

        System.out.println(result);
    }
} Main public static void main(String[] args) {

//        long start1 = System.currentTimeMillis();
//        long end1 = System.currentTimeMillis();
//        System.out.println("time1: " + (end1 - start1));

        Scanner scanner = new Scanner(System.in);

        String[] inputs = scanner.nextLine().split(" ");

        int n = Integer.parseInt(inputs[0]);
        int m = Integer.parseInt(inputs[1]);

        int result = n * (n - 1) / 2 + m * (m - 1) / 2;

        System.out.println(result);
    } main {

//        long start1 = System.currentTimeMillis();
//        long end1 = System.currentTimeMillis();
//        System.out.println("time1: " + (end1 - start1));

        Scanner scanner = new Scanner(System.in);

        String[] inputs = scanner.nextLine().split(" ");

        int n = Integer.parseInt(inputs[0]);
        int m = Integer.parseInt(inputs[1]);

        int result = n * (n - 1) / 2 + m * (m - 1) / 2;

        System.out.println(result);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String[] inputs = scanner.nextLine().split(" "); inputs scanner.nextLine().split(" ") scanner.nextLine().split scanner.nextLine() scanner.nextLine scanner " " int n = Integer.parseInt(inputs[0]); n Integer.parseInt(inputs[0]) Integer.parseInt Integer inputs[0] inputs 0 int m = Integer.parseInt(inputs[1]); m Integer.parseInt(inputs[1]) Integer.parseInt Integer inputs[1] inputs 1 int 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 String[] args args public class Main {

    public static void main(String[] args) {

//        long start1 = System.currentTimeMillis();
//        long end1 = System.currentTimeMillis();
//        System.out.println("time1: " + (end1 - start1));

        Scanner scanner = new Scanner(System.in);

        String[] inputs = scanner.nextLine().split(" ");

        int n = Integer.parseInt(inputs[0]);
        int m = Integer.parseInt(inputs[1]);

        int result = n * (n - 1) / 2 + m * (m - 1) / 2;

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

    public static void main(String[] args) {

//        long start1 = System.currentTimeMillis();
//        long end1 = System.currentTimeMillis();
//        System.out.println("time1: " + (end1 - start1));

        Scanner scanner = new Scanner(System.in);

        String[] inputs = scanner.nextLine().split(" ");

        int n = Integer.parseInt(inputs[0]);
        int m = Integer.parseInt(inputs[1]);

        int result = n * (n - 1) / 2 + m * (m - 1) / 2;

        System.out.println(result);
    }
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

//        long start1 = System.currentTimeMillis();
//        long end1 = System.currentTimeMillis();
//        System.out.println("time1: " + (end1 - start1));

        Scanner scanner = new Scanner(System.in);

        String[] inputs = scanner.nextLine().split(" ");

        int n = Integer.parseInt(inputs[0]);
        int m = Integer.parseInt(inputs[1]);

        int result = n * (n - 1) / 2 + m * (m - 1) / 2;

        System.out.println(result);
    }
}