using System;
using System.Net.Sockets;
using System.Net;
using System.IO;
using System.Text;


namespace Bruh{

    class Program{

         static void Main(string[] args){
            string[] s = Console.ReadLine().Split();
            int a = int.Parse(s[0]);
            int b = int.Parse(s[1]);
            if(a>2&&b>2)
            Console.WriteLine(2*a + 2*b - 4 + ((a-2)*(b-2))/2);         
            else Console.WriteLine(a*b);
         }
    }
}