#!/usr/bin/env PyPy3 from collections import Counter, defaultdict, deque import itertools import re import math from functools import reduce import operator import bisect import heapq import functools mod=10**9+7 import sys input=sys.stdin.readline x,y=map(int,input().split()) if abs(x-y) == 4: print((max(x,y)+4) % 12) else: print((x+y) // 2)