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

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

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