import Control.Applicative
import Data.List

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

solve n m 
    | n == 1 && m == 1 = 1
    | n == 1 && m /= 1 = m-2
    | otherwise = (n-2)*(m-2)
