object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val N, M = sc.nextLong()
  val reverseCount =
    (N, M) match {
      case (1, 1) => 1
      case (1, m) => m - 2
      case (n, 1) => n - 2
      case (n, m) => (n - 2) * (m - 2)
    }
  println(reverseCount)
}
