import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val n = sc.nextLong()
  val m = sc.nextLong()

  if (n == 1L && m == 1L) {
    println(1)
    return
  }

  if (n <= 2L && m <= 2L) {
    println(0)
    return
  }
  if (n == 1L || m == 1L) {
    println(n*m - 2L)
    return
  }
  if (n == 2L || m == 2L) {
    println(0)
    return
  }

  println((n-2L)*(m-2L))

}
