using System;

namespace Zad2
{
	class Program
	{
		static void Main(string[] args)
		{
			string[] input = Console.ReadLine().Split();
			int n = int.Parse(input[0]);
			int m = int.Parse(input[1]);
			int x = n - 2;
			int y = m - 2;
			int j = 2 * m + 2 * n - 4;
			Console.WriteLine(j + (x * y) / 2);
		}
	}
}