
import scala.io.StdIn

object Main extends App {
  var a = StdIn.readLine().split(' ').map(_.toLong).sorted

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

}