main = do
    [n,m] <- map read.words<$>getLine
    print $ case (n,m) of
        (n,m) | n==2 || m==2 -> 0
        (n,m) | n==1 && m==1 -> 1
        (n,m) | n==1 -> m-2
        (n,m) | m==1 -> n-2
        (n,m) | True -> (n-2) * (m-2)