X, Y = map(int, input().split()) A = max(X, Y) Z_1 = (int(X+Y))/2 Z_2 = (int(X+Y))/2 - 6 Z_3 = (int(X+Y))/2 + 6 if Z_2 < 0: Z = Z_3 else: if A-Z_1 < A-Z_2: Z = Z_2 else: Z = Z_1 print(round(Z))