fun main(args: Array<String>) {
    fun max(x: Long, y:Long) = if (x > y) x else y
    val sc = java.util.Scanner(System.`in`)
    val N = sc.next().toLong()
    val M = sc.next().toLong()

    if (M == 1L && N == 1L){
        println(1)
    } else if (M == 1L || N == 1L) {
        println( max(N,M) - 2 )
    } else {
        println( (N-2)*(M-2) )
    }

}