using System;
using System.Linq;

class Solution{
	static void Main(){
      	
		int[] ar = Array.ConvertAll(Console.ReadLine().Split(' '), arTemp => Convert.ToInt32(arTemp));
      	
      	int totalApplePieceAmount = ar[0] * 3 + ar[1];
      
      	Console.WriteLine(Math.Floor(totalApplePieceAmount/3));
      	
      
    }
}
