func solve(m : Int, n: Int) -> Int { if n == 1 && m == 1 { return 0 } let a = min(m, n) let b = max(m, n) let c = b / 2 return 1 + 2 * solve(min(a, c), n: max(a, c)) + (b % 2) * a; } let param = readLine()!.characters.split(" ").map { Int(String($0))! } print(solve(param[0], n: param[1]))