import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {
    private static int MOD = 1000000007;


    public static void main(String[] args) throws IOException {
        InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        String s = br.readLine();
        int n = Integer.parseInt(s.split(" ")[0]);
        int m = Integer.parseInt(s.split(" ")[1]);

        long n_ans = calcCombination(n, 2);
        long m_ans = calcCombination(m, 2);
        System.out.println(n_ans + m_ans);
    }

    private static long calcCombination(int n, int m) {
        if (n < m || m < 0) {
            return 0;
        }
        long c = 1;
        m = (n - m < m ? n - m : m);
        for (int ns = n - m + 1, ms = 1; ms <= m; ns++, ms++) {
            c *= ns;
            c /= ms;
        }
        return c;
    }

} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
    private static int MOD = 1000000007;


    public static void main(String[] args) throws IOException {
        InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        String s = br.readLine();
        int n = Integer.parseInt(s.split(" ")[0]);
        int m = Integer.parseInt(s.split(" ")[1]);

        long n_ans = calcCombination(n, 2);
        long m_ans = calcCombination(m, 2);
        System.out.println(n_ans + m_ans);
    }

    private static long calcCombination(int n, int m) {
        if (n < m || m < 0) {
            return 0;
        }
        long c = 1;
        m = (n - m < m ? n - m : m);
        for (int ns = n - m + 1, ms = 1; ms <= m; ns++, ms++) {
            c *= ns;
            c /= ms;
        }
        return c;
    }

} Main private static int MOD = 1000000007; MOD 1000000007 public static void main(String[] args) throws IOException {
        InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        String s = br.readLine();
        int n = Integer.parseInt(s.split(" ")[0]);
        int m = Integer.parseInt(s.split(" ")[1]);

        long n_ans = calcCombination(n, 2);
        long m_ans = calcCombination(m, 2);
        System.out.println(n_ans + m_ans);
    } main {
        InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        String s = br.readLine();
        int n = Integer.parseInt(s.split(" ")[0]);
        int m = Integer.parseInt(s.split(" ")[1]);

        long n_ans = calcCombination(n, 2);
        long m_ans = calcCombination(m, 2);
        System.out.println(n_ans + m_ans);
    } InputStreamReader isr = new InputStreamReader(System.in); isr new InputStreamReader(System.in) BufferedReader br = new BufferedReader(isr); br new BufferedReader(isr) String s = br.readLine(); s br.readLine() br.readLine br int n = Integer.parseInt(s.split(" ")[0]); n Integer.parseInt(s.split(" ")[0]) Integer.parseInt Integer s.split(" ")[0] s.split(" ") s.split s " " 0 int m = Integer.parseInt(s.split(" ")[1]); m Integer.parseInt(s.split(" ")[1]) Integer.parseInt Integer s.split(" ")[1] s.split(" ") s.split s " " 1 long n_ans = calcCombination(n, 2); n_ans calcCombination(n, 2) calcCombination n 2 long m_ans = calcCombination(m, 2); m_ans calcCombination(m, 2) calcCombination m 2 System.out.println(n_ans + m_ans) System.out.println System.out System System.out n_ans + m_ans n_ans m_ans String[] args args private static long calcCombination(int n, int m) {
        if (n < m || m < 0) {
            return 0;
        }
        long c = 1;
        m = (n - m < m ? n - m : m);
        for (int ns = n - m + 1, ms = 1; ms <= m; ns++, ms++) {
            c *= ns;
            c /= ms;
        }
        return c;
    } calcCombination {
        if (n < m || m < 0) {
            return 0;
        }
        long c = 1;
        m = (n - m < m ? n - m : m);
        for (int ns = n - m + 1, ms = 1; ms <= m; ns++, ms++) {
            c *= ns;
            c /= ms;
        }
        return c;
    } if (n < m || m < 0) {
            return 0;
        } n < m || m < 0 n < m n m m < 0 m 0 {
            return 0;
        } return 0; 0 long c = 1; c 1 m = (n - m < m ? n - m : m) m (n - m < m ? n - m : m) n - m < m n - m n m m n - m n m m for (int ns = n - m + 1, ms = 1; ms <= m; ns++, ms++) {
            c *= ns;
            c /= ms;
        } int ns = n - m + 1, ms = 1; int ns = n - m + 1 ns n - m + 1 n - m n m 1 ms = 1; ms 1 ms <= m ms m ns++, ms++ ns++ ns ms++ ms {
            c *= ns;
            c /= ms;
        } {
            c *= ns;
            c /= ms;
        } c *= ns c ns c /= ms c ms return c; c int n n int m m public class Main {
    private static int MOD = 1000000007;


    public static void main(String[] args) throws IOException {
        InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        String s = br.readLine();
        int n = Integer.parseInt(s.split(" ")[0]);
        int m = Integer.parseInt(s.split(" ")[1]);

        long n_ans = calcCombination(n, 2);
        long m_ans = calcCombination(m, 2);
        System.out.println(n_ans + m_ans);
    }

    private static long calcCombination(int n, int m) {
        if (n < m || m < 0) {
            return 0;
        }
        long c = 1;
        m = (n - m < m ? n - m : m);
        for (int ns = n - m + 1, ms = 1; ms <= m; ns++, ms++) {
            c *= ns;
            c /= ms;
        }
        return c;
    }

} public class Main {
    private static int MOD = 1000000007;


    public static void main(String[] args) throws IOException {
        InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        String s = br.readLine();
        int n = Integer.parseInt(s.split(" ")[0]);
        int m = Integer.parseInt(s.split(" ")[1]);

        long n_ans = calcCombination(n, 2);
        long m_ans = calcCombination(m, 2);
        System.out.println(n_ans + m_ans);
    }

    private static long calcCombination(int n, int m) {
        if (n < m || m < 0) {
            return 0;
        }
        long c = 1;
        m = (n - m < m ? n - m : m);
        for (int ns = n - m + 1, ms = 1; ms <= m; ns++, ms++) {
            c *= ns;
            c /= ms;
        }
        return c;
    }

} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {
    private static int MOD = 1000000007;


    public static void main(String[] args) throws IOException {
        InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        String s = br.readLine();
        int n = Integer.parseInt(s.split(" ")[0]);
        int m = Integer.parseInt(s.split(" ")[1]);

        long n_ans = calcCombination(n, 2);
        long m_ans = calcCombination(m, 2);
        System.out.println(n_ans + m_ans);
    }

    private static long calcCombination(int n, int m) {
        if (n < m || m < 0) {
            return 0;
        }
        long c = 1;
        m = (n - m < m ? n - m : m);
        for (int ns = n - m + 1, ms = 1; ms <= m; ns++, ms++) {
            c *= ns;
            c /= ms;
        }
        return c;
    }

}
