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

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