let () =
    let answer = Scanf.scanf "%d %d" (fun n m ->
        match n, m with
        | 1, 1 -> 1
        | 1, _ -> m - 2
        | _, 1 -> n - 2
        | _, _ -> (n - 2) * (m - 2)
    )
    in Printf.printf "%d\n" answer
