fun readInts() = readLine()!!.split(' ').map(String::toInt)

fun main(args: Array<String>) {
    val (n, m) = readInts().sorted()
    val ans = if (n == 1) {
        when (m) {
            1 -> 1L
            2 -> 0L
            else -> (m - 2).toLong()
        }
    } else if (n == 2) {
        0L
    } else {
        (n - 2).toLong() * (m - 2).toLong()
    }
    println(ans)
}
