N,M=map(int,input().split()) if N%2==0 and M%2==0: print(0) exit() if N%2==0: print(M//4) exit() elif M%2==0: print(N//4) exit() else: print(N//4+M//4)