main = do
  [h, w] <- sort . map read . words <$> getLine
  print $ solve h w

solve h w
  | h `mod` 3 == 0 = 0
  | w `mod` 3 == 0 = 0
  | even h = h `div` 2
  | even w = w `div` 2
  | otherwise = h `div` 2 + w `div` 3 + 1