package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	stdin := bufio.NewScanner(os.Stdin)
	stdin.Scan()
	text := strings.Split(stdin.Text(), " ")
	out := Run(text)
	fmt.Println(out)
}

func Run(data []string) string {
	var (
		a = strconv.Atoi(data[0])
		p = strconv.Atoi(data[1])
	)
	ret := ((a / 3) + p) / 2
	return ret
}