using System;
class HelloWorld {
  static void Main() {
     UInt64 n,m;
        string[] s = Console.ReadLine().Split();
        n = UInt64.Parse(s[0]);
        m = UInt64.Parse(s[1]);
        if(n==1)
        {
        Console.WriteLine(m);
        }
        else if(m==1)
        {
            Console.WriteLine(n);
        }
        else
        Console.WriteLine(((n-2)*(m-2))/2 + 2*n + 2*(m-2));
  }
}