object Main extends App {

  val In = io.StdIn.readLine()
  val A = In.split(" ")

  val max:Int = A.max.toInt
  val min:Int = A.min.toInt

  //var arr = Array.ofDim[Int](A(0).toInt, A(1).toInt)

  var N = 0

  if (min == 1) {
    if (max == 1) {
      N = 1
    }else {
        N = max - 2
    }
  }

  if (min == 2) {
    N = 0
  }

  if (min >= 3){
    N = (max - 2) * (min - 2)
  }

  print(N)

}