import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    sc.close();

    int ans = 0;
    if (N == 1 && M == 1) {
      System.out.println(ans);
      return;
    }

    if (1 < N) ans += combination(N, 2);
    if (1 < M) ans += combination(M, 2);

    System.out.println(ans);
  }

  private static int combination(int n, int k) {
    int closer = Math.min(n - k, k);
    int result = 1;
    for (int i = 1; i <= closer; i++)
      result = result * (n - closer + i) / i;
    return result;
  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    sc.close();

    int ans = 0;
    if (N == 1 && M == 1) {
      System.out.println(ans);
      return;
    }

    if (1 < N) ans += combination(N, 2);
    if (1 < M) ans += combination(M, 2);

    System.out.println(ans);
  }

  private static int combination(int n, int k) {
    int closer = Math.min(n - k, k);
    int result = 1;
    for (int i = 1; i <= closer; i++)
      result = result * (n - closer + i) / i;
    return result;
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    sc.close();

    int ans = 0;
    if (N == 1 && M == 1) {
      System.out.println(ans);
      return;
    }

    if (1 < N) ans += combination(N, 2);
    if (1 < M) ans += combination(M, 2);

    System.out.println(ans);
  } main {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    sc.close();

    int ans = 0;
    if (N == 1 && M == 1) {
      System.out.println(ans);
      return;
    }

    if (1 < N) ans += combination(N, 2);
    if (1 < M) ans += combination(M, 2);

    System.out.println(ans);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int M = sc.nextInt(); M sc.nextInt() sc.nextInt sc sc.close() sc.close sc int ans = 0; ans 0 if (N == 1 && M == 1) {
      System.out.println(ans);
      return;
    } N == 1 && M == 1 N == 1 N 1 M == 1 M 1 {
      System.out.println(ans);
      return;
    } System.out.println(ans) System.out.println System.out System System.out ans return; if (1 < N) ans += combination(N, 2); 1 < N 1 N ans += combination(N, 2) ans combination(N, 2) combination N 2 if (1 < M) ans += combination(M, 2); 1 < M 1 M ans += combination(M, 2) ans combination(M, 2) combination M 2 System.out.println(ans) System.out.println System.out System System.out ans String[] args args private static int combination(int n, int k) {
    int closer = Math.min(n - k, k);
    int result = 1;
    for (int i = 1; i <= closer; i++)
      result = result * (n - closer + i) / i;
    return result;
  } combination {
    int closer = Math.min(n - k, k);
    int result = 1;
    for (int i = 1; i <= closer; i++)
      result = result * (n - closer + i) / i;
    return result;
  } int closer = Math.min(n - k, k); closer Math.min(n - k, k) Math.min Math n - k n k k int result = 1; result 1 for (int i = 1; i <= closer; i++)
      result = result * (n - closer + i) / i; int i = 1; int i = 1; i 1 i <= closer i closer i++ i++ i result = result * (n - closer + i) / i; result = result * (n - closer + i) / i result result * (n - closer + i) / i result * (n - closer + i) result (n - closer + i) n - closer n closer i i return result; result int n n int k k public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    sc.close();

    int ans = 0;
    if (N == 1 && M == 1) {
      System.out.println(ans);
      return;
    }

    if (1 < N) ans += combination(N, 2);
    if (1 < M) ans += combination(M, 2);

    System.out.println(ans);
  }

  private static int combination(int n, int k) {
    int closer = Math.min(n - k, k);
    int result = 1;
    for (int i = 1; i <= closer; i++)
      result = result * (n - closer + i) / i;
    return result;
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    sc.close();

    int ans = 0;
    if (N == 1 && M == 1) {
      System.out.println(ans);
      return;
    }

    if (1 < N) ans += combination(N, 2);
    if (1 < M) ans += combination(M, 2);

    System.out.println(ans);
  }

  private static int combination(int n, int k) {
    int closer = Math.min(n - k, k);
    int result = 1;
    for (int i = 1; i <= closer; i++)
      result = result * (n - closer + i) / i;
    return result;
  }
} Main
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    sc.close();

    int ans = 0;
    if (N == 1 && M == 1) {
      System.out.println(ans);
      return;
    }

    if (1 < N) ans += combination(N, 2);
    if (1 < M) ans += combination(M, 2);

    System.out.println(ans);
  }

  private static int combination(int n, int k) {
    int closer = Math.min(n - k, k);
    int result = 1;
    for (int i = 1; i <= closer; i++)
      result = result * (n - closer + i) / i;
    return result;
  }
}
