import           Data.List

main = do
  [n, m] <- map read . words <$> getLine
  let _n = take n [x | x <- [1 ..], even x]
      _m = take m [x | x <- [1 ..], odd x]
      _nm = nubBy
        (\x y -> ((fst x == fst y) && (snd x == snd y))
         || ((fst x == snd y) && (snd x == fst y)))
        [(x, y) | x <- _n ++ _m, y <- _n ++ _m, x /= y]
      _nm0 = [(a, b) | (a, b) <- _nm, even $ a + b]
  print $ length _nm0
