using System;
using System.Threading.Tasks;
public class Program
{

    public static void Main()
    {
        while (true){
            string[] str = Console.ReadLine().Split();
            int a = int.Parse(str[0]);
            int b = int.Parse(str[1]);
            if(a>2 && b>2)
                Console.WriteLine(2 * (a + b) - 4 + ((a - 2) * (b - 2) / 2));
            else
            {
                Console.WriteLine(a*b);
            }
        }
    }
}