using System;
using System.Text;
using System.Diagnostics;
using System.IO;
using System.Collections.Generic;
using System.Linq;

class cppboljiodcs
{
    static void Main()
    {
        string[] prviRed = Console.ReadLine().Split();
        ulong n = ulong.Parse(prviRed[0]);
        ulong m = ulong.Parse(prviRed[1]);
        
        ulong zbir = (n - 2) * 2 + 2 * m + (n-2)*(m-2)/2;
        Console.WriteLine(zbir);

        Console.ReadKey(); // OBRISI KAD ZAVRSISSSSSSS
    }
}