import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(max(1000, 10**9)) write = lambda x: sys.stdout.write(x+"\n") # inputna n,m = list(map(int, input().split())) if n%2==0 and m%2==0: ans = 0 elif n%2==0: ans = n//4 elif m%2==0: ans = m//4 else: ans = n//4 + m//4 print(ans)