module Main where
import Data.Char
int = read :: String -> Int
inte = read :: String -> Integer
getWord :: IO String
getWord = do
  c <- getChar
  if isSpace c
  then
    return []
  else do
    ws <- getWord
    return (c:ws)
getInt = fmap int getWord
replace pred a = map (\x -> if pred x then a else x)

main = interact $ printer . solver . parser
parser = map inte . words
printer = unlines . (:[]) . show 

solver (n:m:xs)
  | n == 1 = if m==1 then 1 else m - 2
  | n == 2 = 0
  | n >= 3 = if m==1 then 1 else (n-2)*(m-2)

