main :: IO ()
main = do
    [n, m] <- map read . words <$> getLine :: IO [Int]
    print $ solve n m

solve n m
    | n == 1 = max 0 (m - 2)
    | m == 1 = max 0 (n - 2)
    | otherwise = max 0 $ n * m + 4 - 2 * (n + m)