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

namespace Drugi_zadatak
{
    internal class Program
    {
        static int BrojRedara(int n, int m)
        {
            int spoljasnji;
            if (n == 1 && m == 1)
                return 1;
            else
            {
                if (m == 1)
                    return n;
                else if (n == 1)
                    return m;
            }

            spoljasnji = 2 * n + 2 * (m - 2);
            int unutrasnji = (n - 2) * (m - 2) / 2;
            return spoljasnji + unutrasnji;
        }
        static bool ValidanUlaz(int n, int m)
        {
            int gr = 1000000000;
            if (n >= 1 && n <= gr && m >= 1 && m <= gr)
                return true;
            return false;
        }
        static void Main(string[] args)
        {
            string[] nm = Console.ReadLine().Split();
            int n = int.Parse(nm[0]);
            int m = int.Parse(nm[1]);
            if(ValidanUlaz(n, m))
            {
                Console.WriteLine(BrojRedara(n, m));
            }
        }
    }
}