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