using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO.Pipes;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
        
        static void Main(string[] args)
        {
            string[] s1 = Console.ReadLine().Split(' ');
            int n = int.Parse(s1[0]);
            int m = int.Parse(s1[1]);

            int cuvari = 0;

            for (int i = 1; i < n; i++)
            {
                if (i % 2 == 1 && i != n - 1)
                {
                    cuvari += 3;
                }
                else if (i % 2 == 0 && i != n - 1)
                {
                    cuvari += 4;
                }
            }

            Console.WriteLine(cuvari + 2 * m);
        }
    }
}