let () =
  Scanf.scanf "%d %d" (fun m n ->
    let a, b = min m n, max m n in
    if a = 1 then (if b = 1 then 1 else max 0 (b-2))
    else if a = 2 then 0
    else (a-2) * (b-2))
  |> Printf.printf "%d\n"
