import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {

    public static void main(String[] args) throws Exception {
        PrintWriter out = new PrintWriter(System.out);
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] lines = br.readLine().split(" ");
        int N = Integer.parseInt(lines[0]);
        int M = Integer.parseInt(lines[1]);
        out.println(N*(N-1)/2 + M*(M-1)/2);
        out.flush();
        out.close();
        br.close();
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.PrintWriter; PrintWriter java.io public class Main {

    public static void main(String[] args) throws Exception {
        PrintWriter out = new PrintWriter(System.out);
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] lines = br.readLine().split(" ");
        int N = Integer.parseInt(lines[0]);
        int M = Integer.parseInt(lines[1]);
        out.println(N*(N-1)/2 + M*(M-1)/2);
        out.flush();
        out.close();
        br.close();
    }
} Main public static void main(String[] args) throws Exception {
        PrintWriter out = new PrintWriter(System.out);
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] lines = br.readLine().split(" ");
        int N = Integer.parseInt(lines[0]);
        int M = Integer.parseInt(lines[1]);
        out.println(N*(N-1)/2 + M*(M-1)/2);
        out.flush();
        out.close();
        br.close();
    } main {
        PrintWriter out = new PrintWriter(System.out);
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] lines = br.readLine().split(" ");
        int N = Integer.parseInt(lines[0]);
        int M = Integer.parseInt(lines[1]);
        out.println(N*(N-1)/2 + M*(M-1)/2);
        out.flush();
        out.close();
        br.close();
    } PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String[] lines = br.readLine().split(" "); lines br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int N = Integer.parseInt(lines[0]); N Integer.parseInt(lines[0]) Integer.parseInt Integer lines[0] lines 0 int M = Integer.parseInt(lines[1]); M Integer.parseInt(lines[1]) Integer.parseInt Integer lines[1] lines 1 out.println(N*(N-1)/2 + M*(M-1)/2) out.println out 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 out.flush() out.flush out out.close() out.close out br.close() br.close br String[] args args public class Main {

    public static void main(String[] args) throws Exception {
        PrintWriter out = new PrintWriter(System.out);
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] lines = br.readLine().split(" ");
        int N = Integer.parseInt(lines[0]);
        int M = Integer.parseInt(lines[1]);
        out.println(N*(N-1)/2 + M*(M-1)/2);
        out.flush();
        out.close();
        br.close();
    }
} public class Main {

    public static void main(String[] args) throws Exception {
        PrintWriter out = new PrintWriter(System.out);
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] lines = br.readLine().split(" ");
        int N = Integer.parseInt(lines[0]);
        int M = Integer.parseInt(lines[1]);
        out.println(N*(N-1)/2 + M*(M-1)/2);
        out.flush();
        out.close();
        br.close();
    }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {

    public static void main(String[] args) throws Exception {
        PrintWriter out = new PrintWriter(System.out);
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] lines = br.readLine().split(" ");
        int N = Integer.parseInt(lines[0]);
        int M = Integer.parseInt(lines[1]);
        out.println(N*(N-1)/2 + M*(M-1)/2);
        out.flush();
        out.close();
        br.close();
    }
}