arguments = input()
arguments_as_list = arguments.split(" ")
list_to_integer = list(map(int, arguments_as_list))
apples = list_to_integer(0)
pieces = list_to_integer(1)

print((apples//3 + pieces)//2)