import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    //nextLineとnextを同時に使ったら死ぬ
    val sc = new Scanner(System.in)
    val n, m = sc.nextLong()
    if (math.min(n, m) == 1L) {
      println(math.max(0L, n * m - 2L))
    } else {
      println(n * m - 2 * n - 2 * m + 4)
    }
  }
  def debug(args: Any*): Unit = {
    Console.err.println(args.mkString(" "))
  }
}
