import scala.io.StdIn

object Main extends App {
  val Array(n, m) = StdIn.readLine().split(' ').map(_.toInt)

  println(if (n == 1 && m == 1) 1 else if (n == 1 && m != 1) m - 2 else (n - 2) * (m - 2))

}