import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    }

    static class A {
        static final int mod = 1000000007;

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            int m = Integer.parseInt(in.next());
            int ans = 0;

            ans = nCk(n, 2, mod) + nCk(m, 2, mod);
            if (n == 0) ans--;
            if (m == 0) ans--;
            if (n == 1) ans--;
            if (m == 1) ans--;

            // 出力
            out.println(ans);

        }

        public static int nCk(int n, int k, int M) {
            long ret = 1;
            int min = Math.min(k, n - k);
            for (int i = 1; i <= min; i++) {
                ret = (ret * pow(i, M - 2, M)) % M;
            }
            for (int i = n - min + 1; i <= n; i++) {
                ret = (ret * i) % M;
            }
            return (int) ret;
        }

        public static long pow(long a, long b, int M) {
            long ret = 1;
            long tmp = a;
            while (b > 0) {
                if ((b & 1) == 1) ret = (ret * tmp) % M;
                tmp = (tmp * tmp) % M;
                b = b >> 1;
            }
            return ret;
        }

    }
}
 import java.io.OutputStream; OutputStream java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    }

    static class A {
        static final int mod = 1000000007;

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            int m = Integer.parseInt(in.next());
            int ans = 0;

            ans = nCk(n, 2, mod) + nCk(m, 2, mod);
            if (n == 0) ans--;
            if (m == 0) ans--;
            if (n == 1) ans--;
            if (m == 1) ans--;

            // 出力
            out.println(ans);

        }

        public static int nCk(int n, int k, int M) {
            long ret = 1;
            int min = Math.min(k, n - k);
            for (int i = 1; i <= min; i++) {
                ret = (ret * pow(i, M - 2, M)) % M;
            }
            for (int i = n - min + 1; i <= n; i++) {
                ret = (ret * i) % M;
            }
            return (int) ret;
        }

        public static long pow(long a, long b, int M) {
            long ret = 1;
            long tmp = a;
            while (b > 0) {
                if ((b & 1) == 1) ret = (ret * tmp) % M;
                tmp = (tmp * tmp) % M;
                b = b >> 1;
            }
            return ret;
        }

    }
} Main public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    } main {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    } InputStream inputStream = System.in; inputStream System.in System System.in OutputStream outputStream = System.out; outputStream System.out System System.out Scanner in = new Scanner(inputStream); in new Scanner(inputStream) PrintWriter out = new PrintWriter(outputStream); out new PrintWriter(outputStream) A solver = new A(); solver new A() solver.solve(1, in, out) solver.solve solver 1 in out out.close() out.close out String[] args args static class A {
        static final int mod = 1000000007;

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            int m = Integer.parseInt(in.next());
            int ans = 0;

            ans = nCk(n, 2, mod) + nCk(m, 2, mod);
            if (n == 0) ans--;
            if (m == 0) ans--;
            if (n == 1) ans--;
            if (m == 1) ans--;

            // 出力
            out.println(ans);

        }

        public static int nCk(int n, int k, int M) {
            long ret = 1;
            int min = Math.min(k, n - k);
            for (int i = 1; i <= min; i++) {
                ret = (ret * pow(i, M - 2, M)) % M;
            }
            for (int i = n - min + 1; i <= n; i++) {
                ret = (ret * i) % M;
            }
            return (int) ret;
        }

        public static long pow(long a, long b, int M) {
            long ret = 1;
            long tmp = a;
            while (b > 0) {
                if ((b & 1) == 1) ret = (ret * tmp) % M;
                tmp = (tmp * tmp) % M;
                b = b >> 1;
            }
            return ret;
        }

    } A static final int mod = 1000000007; mod 1000000007 public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            int m = Integer.parseInt(in.next());
            int ans = 0;

            ans = nCk(n, 2, mod) + nCk(m, 2, mod);
            if (n == 0) ans--;
            if (m == 0) ans--;
            if (n == 1) ans--;
            if (m == 1) ans--;

            // 出力
            out.println(ans);

        } solve {
            // 入力
            int n = Integer.parseInt(in.next());
            int m = Integer.parseInt(in.next());
            int ans = 0;

            ans = nCk(n, 2, mod) + nCk(m, 2, mod);
            if (n == 0) ans--;
            if (m == 0) ans--;
            if (n == 1) ans--;
            if (m == 1) ans--;

            // 出力
            out.println(ans);

        } int n = Integer.parseInt(in.next()); n Integer.parseInt(in.next()) Integer.parseInt Integer in.next() in.next in int m = Integer.parseInt(in.next()); m Integer.parseInt(in.next()) Integer.parseInt Integer in.next() in.next in int ans = 0; ans 0 ans = nCk(n, 2, mod) + nCk(m, 2, mod) ans nCk(n, 2, mod) + nCk(m, 2, mod) nCk(n, 2, mod) nCk n 2 mod nCk(m, 2, mod) nCk m 2 mod if (n == 0) ans--; n == 0 n 0 ans-- ans if (m == 0) ans--; m == 0 m 0 ans-- ans if (n == 1) ans--; n == 1 n 1 ans-- ans if (m == 1) ans--; m == 1 m 1 ans-- ans out.println(ans) out.println out ans int testNumber testNumber Scanner in in PrintWriter out out public static int nCk(int n, int k, int M) {
            long ret = 1;
            int min = Math.min(k, n - k);
            for (int i = 1; i <= min; i++) {
                ret = (ret * pow(i, M - 2, M)) % M;
            }
            for (int i = n - min + 1; i <= n; i++) {
                ret = (ret * i) % M;
            }
            return (int) ret;
        } nCk {
            long ret = 1;
            int min = Math.min(k, n - k);
            for (int i = 1; i <= min; i++) {
                ret = (ret * pow(i, M - 2, M)) % M;
            }
            for (int i = n - min + 1; i <= n; i++) {
                ret = (ret * i) % M;
            }
            return (int) ret;
        } long ret = 1; ret 1 int min = Math.min(k, n - k); min Math.min(k, n - k) Math.min Math k n - k n k for (int i = 1; i <= min; i++) {
                ret = (ret * pow(i, M - 2, M)) % M;
            } int i = 1; int i = 1; i 1 i <= min i min i++ i++ i {
                ret = (ret * pow(i, M - 2, M)) % M;
            } {
                ret = (ret * pow(i, M - 2, M)) % M;
            } ret = (ret * pow(i, M - 2, M)) % M ret (ret * pow(i, M - 2, M)) % M (ret * pow(i, M - 2, M)) ret pow(i, M - 2, M) pow i M - 2 M 2 M M for (int i = n - min + 1; i <= n; i++) {
                ret = (ret * i) % M;
            } int i = n - min + 1; int i = n - min + 1; i n - min + 1 n - min n min 1 i <= n i n i++ i++ i {
                ret = (ret * i) % M;
            } {
                ret = (ret * i) % M;
            } ret = (ret * i) % M ret (ret * i) % M (ret * i) ret i M return (int) ret; (int) ret int n n int k k int M M public static long pow(long a, long b, int M) {
            long ret = 1;
            long tmp = a;
            while (b > 0) {
                if ((b & 1) == 1) ret = (ret * tmp) % M;
                tmp = (tmp * tmp) % M;
                b = b >> 1;
            }
            return ret;
        } pow {
            long ret = 1;
            long tmp = a;
            while (b > 0) {
                if ((b & 1) == 1) ret = (ret * tmp) % M;
                tmp = (tmp * tmp) % M;
                b = b >> 1;
            }
            return ret;
        } long ret = 1; ret 1 long tmp = a; tmp a while (b > 0) {
                if ((b & 1) == 1) ret = (ret * tmp) % M;
                tmp = (tmp * tmp) % M;
                b = b >> 1;
            } b > 0 b 0 {
                if ((b & 1) == 1) ret = (ret * tmp) % M;
                tmp = (tmp * tmp) % M;
                b = b >> 1;
            } if ((b & 1) == 1) ret = (ret * tmp) % M; (b & 1) == 1 (b & 1) b 1 1 ret = (ret * tmp) % M ret (ret * tmp) % M (ret * tmp) ret tmp M tmp = (tmp * tmp) % M tmp (tmp * tmp) % M (tmp * tmp) tmp tmp M b = b >> 1 b b >> 1 b 1 return ret; ret long a a long b b int M M public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    }

    static class A {
        static final int mod = 1000000007;

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            int m = Integer.parseInt(in.next());
            int ans = 0;

            ans = nCk(n, 2, mod) + nCk(m, 2, mod);
            if (n == 0) ans--;
            if (m == 0) ans--;
            if (n == 1) ans--;
            if (m == 1) ans--;

            // 出力
            out.println(ans);

        }

        public static int nCk(int n, int k, int M) {
            long ret = 1;
            int min = Math.min(k, n - k);
            for (int i = 1; i <= min; i++) {
                ret = (ret * pow(i, M - 2, M)) % M;
            }
            for (int i = n - min + 1; i <= n; i++) {
                ret = (ret * i) % M;
            }
            return (int) ret;
        }

        public static long pow(long a, long b, int M) {
            long ret = 1;
            long tmp = a;
            while (b > 0) {
                if ((b & 1) == 1) ret = (ret * tmp) % M;
                tmp = (tmp * tmp) % M;
                b = b >> 1;
            }
            return ret;
        }

    }
} public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    }

    static class A {
        static final int mod = 1000000007;

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            int m = Integer.parseInt(in.next());
            int ans = 0;

            ans = nCk(n, 2, mod) + nCk(m, 2, mod);
            if (n == 0) ans--;
            if (m == 0) ans--;
            if (n == 1) ans--;
            if (m == 1) ans--;

            // 出力
            out.println(ans);

        }

        public static int nCk(int n, int k, int M) {
            long ret = 1;
            int min = Math.min(k, n - k);
            for (int i = 1; i <= min; i++) {
                ret = (ret * pow(i, M - 2, M)) % M;
            }
            for (int i = n - min + 1; i <= n; i++) {
                ret = (ret * i) % M;
            }
            return (int) ret;
        }

        public static long pow(long a, long b, int M) {
            long ret = 1;
            long tmp = a;
            while (b > 0) {
                if ((b & 1) == 1) ret = (ret * tmp) % M;
                tmp = (tmp * tmp) % M;
                b = b >> 1;
            }
            return ret;
        }

    }
} Main
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    }

    static class A {
        static final int mod = 1000000007;

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            int m = Integer.parseInt(in.next());
            int ans = 0;

            ans = nCk(n, 2, mod) + nCk(m, 2, mod);
            if (n == 0) ans--;
            if (m == 0) ans--;
            if (n == 1) ans--;
            if (m == 1) ans--;

            // 出力
            out.println(ans);

        }

        public static int nCk(int n, int k, int M) {
            long ret = 1;
            int min = Math.min(k, n - k);
            for (int i = 1; i <= min; i++) {
                ret = (ret * pow(i, M - 2, M)) % M;
            }
            for (int i = n - min + 1; i <= n; i++) {
                ret = (ret * i) % M;
            }
            return (int) ret;
        }

        public static long pow(long a, long b, int M) {
            long ret = 1;
            long tmp = a;
            while (b > 0) {
                if ((b & 1) == 1) ret = (ret * tmp) % M;
                tmp = (tmp * tmp) % M;
                b = b >> 1;
            }
            return ret;
        }

    }
}

