using System;

namespace TAKMICENJE_2_2_FINALE
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] unos = Console.ReadLine().Split();
            long N = long.Parse(unos[0]), M = long.Parse(unos[1]);
            Console.WriteLine((N + M) * 2 - 4 + (N - 2) * (M - 2) / 2);
        }
    }
}