n, m = map(int, input().split()) if min(n, m) == 1: print(max(n, m) // 4) else: print(0)