{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}
import           Data.Int (Int64)

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

solve :: Int64 -> Int64 -> Int64
solve n 1 = n - 2
solve 1 m = m - 2
solve n m = n * m - 2 * (n + m) + 4
