object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n, m = sc.nextLong()
  if (n == 1 && m == 1) {
    println(1)
  } else if (n == 1) {
    println(m - 2)
  } else if (m == 1) {
    println(n - 2)
  } else {
    println((n-2) * (m-2))
  }
}
