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[] s = Console.ReadLine().Split(' ');
            ulong n = ulong.Parse(s[0]), m = ulong.Parse(s[1]);
            ulong redari = 2 * m + 2 * (n - 2);
            for (ulong i = 1; i < n-1; i++)
            {
                if (i % 2 == 1) redari += 1;
                else redari += 2;
            }
            Console.WriteLine(redari);
        }
    }
}