using System;
using System.Linq;
namespace ProgrammingContest_CSharp
{
    class Program
    {
        static void Main(string[] args)
        {
            var A = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
            Console.WriteLine(6*A[0]-9*A[1]);
        }
    }
}