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();
        Int64 n = int.Parse(prviRed[0]);
        Int64 m = int.Parse(prviRed[1]);

        Int64 zbir = (n - 2) * 2 + 2 * m + (n - 2) * (m - 2) / 2;
        Console.WriteLine(zbir);

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