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(N//4+((M-1)//4)) elif M%4==0: print(M//4+((N-1)//4)) else: print(N//4+M//4)