open System
               
let N,M = 
    let t = Console.ReadLine().Split()
            |> Array.map(int64)
    t.[0],t.[1]

match N,M with
| 1L,1L -> 1L
| 1L,_  -> M - 2L
| _ ,1L -> N - 2L
| _     -> (N - 2L) * (M - 2L) 
|> printfn "%i"