import scala.io.StdIn._
object Main extends App {
  readLine.split(" ").map(_.toInt) match {
    case Array(1, 1) => println(1)
    case Array(1, m) => println(m - 2)
    case Array(n, 1) => println(n - 2)
    case Array(n, m) => println((n - 2) * (m - 2))
  }
}
