fun main(args: Array<String>) {
    val (row, col) = readInputLine().split(" ").map { it.toLong() }
    
    if (row == 1L) {
        if (col == 1L) {
            println(1L)
            return
        }
        println(col - 2L)
        return
    }

    if (col == 1L) {
        println(row - 2L)
        return
    }

    println((row - 2L) * (col - 2L))
}

fun readInputLine(): String {
    return readLine()!!
}
