import java.io.*;
import java.util.*;


class Main {
    public static void main(String[] args) {
        Scanner scr = new Scanner(System.in);
//        int t = scr.nextInt();
//        while (t-- > 0)
        solve(scr);
    }


    static void solve(Scanner scr) {
        int N = scr.nextInt();
        int M = scr.nextInt();
        long a = N * (N - 1) / 2;
        long b = M * (M - 1) / 2;
        System.out.println(a+b);
    }


}


 import java.io.*; io.* java import java.util.*; util.* java class Main {
    public static void main(String[] args) {
        Scanner scr = new Scanner(System.in);
//        int t = scr.nextInt();
//        while (t-- > 0)
        solve(scr);
    }


    static void solve(Scanner scr) {
        int N = scr.nextInt();
        int M = scr.nextInt();
        long a = N * (N - 1) / 2;
        long b = M * (M - 1) / 2;
        System.out.println(a+b);
    }


} Main public static void main(String[] args) {
        Scanner scr = new Scanner(System.in);
//        int t = scr.nextInt();
//        while (t-- > 0)
        solve(scr);
    } main {
        Scanner scr = new Scanner(System.in);
//        int t = scr.nextInt();
//        while (t-- > 0)
        solve(scr);
    } Scanner scr = new Scanner(System.in); scr new Scanner(System.in) solve(scr) solve scr String[] args args static void solve(Scanner scr) {
        int N = scr.nextInt();
        int M = scr.nextInt();
        long a = N * (N - 1) / 2;
        long b = M * (M - 1) / 2;
        System.out.println(a+b);
    } solve {
        int N = scr.nextInt();
        int M = scr.nextInt();
        long a = N * (N - 1) / 2;
        long b = M * (M - 1) / 2;
        System.out.println(a+b);
    } int N = scr.nextInt(); N scr.nextInt() scr.nextInt scr int M = scr.nextInt(); M scr.nextInt() scr.nextInt scr long a = N * (N - 1) / 2; a N * (N - 1) / 2 N * (N - 1) N (N - 1) N 1 2 long b = M * (M - 1) / 2; b M * (M - 1) / 2 M * (M - 1) M (M - 1) M 1 2 System.out.println(a+b) System.out.println System.out System System.out a+b a b Scanner scr scr
import java.io.*;
import java.util.*;


class Main {
    public static void main(String[] args) {
        Scanner scr = new Scanner(System.in);
//        int t = scr.nextInt();
//        while (t-- > 0)
        solve(scr);
    }


    static void solve(Scanner scr) {
        int N = scr.nextInt();
        int M = scr.nextInt();
        long a = N * (N - 1) / 2;
        long b = M * (M - 1) / 2;
        System.out.println(a+b);
    }


}



