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

namespace ConsoleApp39
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string brojRedova = Console.ReadLine();
            string[] mn = brojRedova.Split();
            int M = int.Parse(mn[0]);
            int N = int.Parse(mn[1]);
            int brojRedara = 0;
            if (M == N && M != 1) brojRedara = 4 * M - 4 + (M-2)*(N-2)/2;
            else if (M == 1 && N > 1) brojRedara = N;
            else if (N == 1 && M > 1) brojRedara = M;
            else brojRedara = 2 * M + 2 * N - 4 + (M-2)*(N-2)/2;
            Console.WriteLine(brojRedara); 
        }
    }
}