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

namespace takmicenjee22
{
    internal class Program
    {
        static void Main(string[] args)
        {

            string[] brojevi = Console.ReadLine().Split();
            long N = long.Parse(brojevi[0]);
            long M = long.Parse(brojevi[1]);

            long S = 0;
            S = 2 * N + 2 * (M - 2);
            long P = (N - 2) * (M - 2);

            if (N == 1 || M == 1)
            {
                Console.WriteLine(N * M);
            }
            else if (N != 0 && M != 0)
            {

                if (P % 2 == 0)
                {
                    S = S + P / 2;
                    Console.WriteLine(S);
                }
                else if (P % 2 != 0)
                {
                    S = S + (P - 1) / 2;
                    Console.WriteLine(S);
                }
                
            }
            

        }
    }
}