using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.IO;

namespace aaa
{

    class Program
    {
        public static void Main(string[] args)
        {
            uint[] niz1 = Console.ReadLine().Split(' ').Select(x => uint.Parse(x)).ToArray();
            uint n = niz1[1], m = niz1[0];
            uint num = 2 * n + 2 * m - 4 ;
            uint value = ((m - 2) % 2 == 0) ? (n - 2)*(m-2)/2 : ((n - 2) * ((m - 2) / 2)) + (n - 2) / 2;
            Console.WriteLine(num + value);
        }
    }
}