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

namespace _2.zadatak
{
    internal class Program
    {
        static void Main(string[] args)
        {
            int[] nm = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            Console.WriteLine(2 * (nm[0] + nm[1]) - 4 + ((nm[0] - 2) * (nm[1] - 2)) / 2);
        }
    }
}