import scala.io.{StdIn => in}

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

  val ans = (n , m) match {
    case (1, 1) => 1L
    case (a, b) if a == 2 || b == 2 => 0L
    case (a, b) if a == 1 && b != 1 => m - 2L
    case (a, b) if a != 1 && b == 1 => n - 2L
    case _ => (n-2L) * (m-2L)
  }

  println(ans)
}
