fun main(args : Array<String>) {
    val (n, m) = readLine()!!.split(" ").map { it.toLong() }

    if (n == 1L && m == 1L) {
        println(1)
        return
    }

    if (n == 1L) {
        println(m-2L)
        return
    }

    if (m == 1L) {
        println(n-2L)
        return
    }

    println((n-2L) * (m-2L))
}

