using System;

public class Finale
{
    public static void Main(string[] args)
    {
        string r1 = Console.ReadLine();
        string[] u1 = r1.Split();
        ulong n = Convert.ToUInt64(u1[0]);
        ulong m = Convert.ToUInt64(u1[1]);
        ulong res = 0;
        if (m == 1 || n == 1) { res = m + n - 1; }
        else 
        { 
            res = 2 * m + 2 * n - 4 + (m-2)*(n-2)/2;
        }
        Console.WriteLine(res);
        Console.ReadKey();
    }
}