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