using System;
class finale
{
  static void Main() 
  {
    long m,n;
    double s,i;
    var line = Console.ReadLine();
    var data = line.Split(' ');
    n = long.Parse(data[0]);
    m = long.Parse(data[1]);
    if(n <= 2 || m <= 2)
    {
        i = m * n;
        Console.WriteLine(i);
    }
    else
    {
        i = 2 * n + 2 * m;
        i -= 4;
        s = (n - 2) * (m - 2) / 2;
        i += Math.Floor(s);
        Console.WriteLine(i);
    }
  }
}