object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val N, M = sc.nextLong()
  val reverseCount =
    N match {
      case 1 => M match {
        case 1 => 1
        case _ => M - 2
      }
      case _ if M == 1 => N - 2
      case _ => (N - 2) * (M - 2)
    }
  println(reverseCount)
}
