using System;

namespace MarkoDva 
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            int N = int.Parse(s[0]);
            int M = int.Parse(s[1]);
            Int64 NM = N*2+(M-2)*2+(N-2)*(M-2)/2;
            Console.WriteLine(NM);
        }
    }
}