using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Finale
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split();
            int N, M;
            N = Convert.ToInt32(str[0]);
            M = Convert.ToInt32(str[1]);
            Console.WriteLine(2*(N+M-2) + ((N-2)*(M-2))/2);
        }
    }
}