using System;
class HelloWorld 
{
  static void Main() 
  {
      var nm = Console.ReadLine().Split();
      int n = int.Parse(nm[0]);
      int m = int.Parse(nm[1]);
      int suma = 0;
      suma+= 2*n+2*m-4;
      suma+= (m-2)*(n-2)/2;
      Console.WriteLine(suma);
  }
}