fun main(args:Array<String>) {
	val (n,m) = readLine()!!.split(" ").map{ it.toLong() }
	when{
	    n==1L && m==1L -> 1L
	    n==1L && m!=1L -> m-2
	    n!=1L && m==1L -> n-2
	    else -> (n-2)*(m-2)
	}.let {println(it)}
	
}