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