A, B = map(int, input().split()) ans = 0 turn = 0 while A > 0 and B > 0: if turn == 0: A -= 1 turn = 1 else: B -= 1 turn = 0 ans += 1 print(ans)