{-# LANGUAGE OverloadedStrings   #-}
{-# LANGUAGE ScopedTypeVariables #-}

import           Control.Monad
import           Data.IORef
import qualified Data.Text     as T
import qualified Data.Text.IO  as T
import           System.IO

main :: IO ()
main = flipflip

flipflip :: IO ()
flipflip = do
  nmT <- T.getLine
  let [nT, mT] = T.split (== ' ') nmT
      n = read $ T.unpack nT :: Int
      m = read $ T.unpack mT :: Int
      nm = n * m
      ans' = case nm of
              1 -> 1
              2 -> 1
              _ -> (n - 2) * (m - 2)
      ans
        | ans' < 0  = negate ans'
        | otherwise = ans'
  print ans