    fun main(args: Array<String>) {
        val sc = if (args.size > 1) java.util.Scanner(java.io.File(args[1])) else java.util.Scanner(System.`in`)
        solve(sc)
    }

    fun solve(sc: java.util.Scanner) {
        val N = sc.nextInt()
        val M = sc.nextInt()
        val n = when (N) {
            1 -> arrayOf(1)
            2 -> arrayOf(2, 2)
            else -> arrayOf(2, 3, 2)
        }
        val m = when (M) {
            1 -> arrayOf(1)
            2 -> arrayOf(2, 2)
            else -> arrayOf(2, 3, 2)
        }
        val nm = n.flatMap { nn -> m.map { mm -> mm * nn } }
//        println(nm)
        val inside = nm[nm.count() / 2]
        var ans = nm.count { it % 2 == 1 }.toLong()
        if (inside % 2 == 1) {
            ans += (if (N > 2) N - 2 else 1).toLong() * (if (M > 2) M - 2 else 1).toLong() - 1
        }
        println(ans)
    }
