using System;

class Program {
  public static void Main (string[] args) {
    string[] s = Console.ReadLine().Split();
    int N = int.Parse(s[0]), M = int.Parse(s[1]);
    int odgovor = (N-1 + M-1)*2 + ((N-2)*(M-2))/2;
    Console.WriteLine(odgovor);
  }
}