using System;

namespace Spojler
{
    class Program
    {
        static void Main(string[] args)
        {           
            string[] c1 = Console.ReadLine().Split(' ');
            long N = Convert.ToInt64(c1[0]);
            long M = Convert.ToInt64(c1[1]);
            long i = (M - 2) / 2;
            long j = (M - 2) - i;
            long redari = (M - 1) * 2 + (N - 1) * 2; 
            redari += (N - 2) / 2 * j;
            redari += (N - 2 - (N - 2) / 2) * i;

            Console.WriteLine(redari);
 
        }
    }
}