using System;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] unos = Console.ReadLine().Split();
            long n = Convert.ToInt32(unos[0]);
            long m = Convert.ToInt32(unos[1]);

            if (n == 1) Console.WriteLine(m);
            else if (m == 1) Console.WriteLine(n);
            else Console.WriteLine(2*n + 2*(m-2) + (n-2)*(m-2)/2);
            Console.ReadLine();
        }
    }
}