    fun longList() = readLine()?.split(" ")?.map(String::toLong) ?: TODO()
    fun main(args: Array<String>) {
        val (n, m) = longList()
        when {
            n >= 3 && m >= 3 -> {
                val count = (n - 2) * (m - 2)
                println(count.toString())
            }
            else -> {
                if (n == 2L || m == 2L) {
                    println("0")
                } else if (n == 1L && m == 1L) {
                    println("1")
                } else if (n == 1L) {
                    println("${m - 2L}")
                } else if (m == 1L) {
                    println("${n - 2L}")
                }
            }
        }
    }
