calc v = (v + 1) `div` 2

solve h w
  | h == w = h * (w `div` 2) - (calc h) * (w `div` 2)
  | h < w  = h * (w `div` 2) - (calc w) * (h `div` 2)
  | h > w  = w * (h `div` 2) - (calc h) * (w `div` 2)

main = do
  [h,w] <- fmap read <$> words <$> getLine :: IO[Int]
  let v = h * w
  if v `mod` 3 == 0
    then putStrLn . show $ 0
    else putStrLn . show $ solve h w
