n,m=map(int,input().split()) print([0,m//4][n%2]+[0,n//4][m%2]+[0,2][n%4==3and m%4==3and n>3and m>3])