import scala.io._
object Main {
	def main(args: Array[String]) {
		val input = Source.fromInputStream(System.in)
		val lines = input.getLines.toSeq

		var size = lines(0).split(" ").map(_.toInt)
		var res = 0
			
		if(size(0) > 2 && size(1) > 2) {
			res = (size(0) - 2) * (size(1) - 2)
		}else if(size(0) == 1 || size(1) == 1) {
			res = (size(0) * size(1)) - 2
		}else{
			res = 0
		}
		if (res < 0) res *= -1

		println(res)
	}
}