using System;

namespace ConsoleApp7
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split();
            int N = int.Parse(str[0]);
            int M = int.Parse(str[1]);
            if (M == 1 || N == 1)
            {
                Console.WriteLine(M * N);
            }
            else
            {
                Console.WriteLine(N + N + M + M - 4 + (M - 2) * (N - 2) / 2);
            }
        }
    }
}