
main = do
  input <- getLine
  let inputWords = map read $ words  input
      hm = ( inputWords !! 0 )::Word
      wm = ( inputWords !! 1 )::Word
  case  (check3 hm wm ) of
    True -> putStr "0"
    False-> putStr $ show $  getR hm wm

getR h' w' =
  let h = h' `div` 2
      w = w' `div` 2
      delh = h' - w
      delw = w' - w
      s1 = delh * delw
      s2 = delh * w
      s3 = delw * h
      dels23 = max s2 s3 + min s2 s3
  in s1 - dels23 
  


check3 h w | (h `mod` 3 == 0) || (w `mod` 3 == 0) = True
           | otherwise                            = False

