using System;

namespace ConsoleApp3
{
	class Program
	{
		static void Main( string[] args )
		{
			string[] mn = Console.ReadLine().Split();
			int m = Convert.ToInt32( mn[ 0 ] );
			long n = Convert.ToInt32( mn[ 1 ] );
			Console.WriteLine((m+n)*2 - 4 + ((m-2)*(n-2))/2);
		}
	}
}