using System;

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

            long x = 2 * m + (n - 2) * 2 + ((m - 2) * (n - 2)) / 2;
            Console.WriteLine(x);
        }
    }
}