using System;

namespace takmicenje2
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s1 = Console.ReadLine().Split();
            int n = Convert.ToInt32(s1[0]);
            int m = Convert.ToInt32(s1[1]);
            if (n == 1) Console.WriteLine(m);
            else if (m == 1) Console.WriteLine(n);
            else Console.WriteLine((m - 2) * (n - 2) / 2 + 2 * (m + n) - 4);
        }
    }
}