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

namespace ConsoleApplication36
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            long n = long.Parse(s[0]); 
            long m = long.Parse(s[1]);
            long o=0;
            if (m == 1 || n == 1)
            {
                o = n+m-1;
            }
            else o = (n + m) * 2 - 4;
            long u = 0;
            if (n > 2 && m > 2)
            {
                u = ((n - 2) * (m - 2)) / 2;
            } 
            Console.WriteLine(o+u);
        
        }
    }
}