module Main where

import Control.Applicative
import Control.Monad
import Data.List

main :: IO ()
main = do
    [n, m] <- fmap read . words <$> getLine :: IO [Int]
    let ans = case sort [n, m] of
            [1, 1] -> 1
            [1, 2] -> 0
            [1, b] -> b - 2
            [2, _] -> 0
            [s, t] -> (s - 2) * (t - 2)
    print ans