import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) { Scanner scan = new Scanner(System.in); long x = scan.nextLong(); long y = scan.nextLong(); System.out.println(x * y - 1); //System.out.println(cutSquare(x,y)); } public static int cutSquare(int x, int y) { System.out.println("Cutsquare run on (" + x + ", " + y + ")"); int retVal; if(x == 1) { return y-1; } if(y == 1) { return x-1; } if(x > y) { if((x % 2) == 0) { retVal = 1 + (cutSquare(x/2, y) * 2); } else { retVal = 1 + cutSquare(x/2, y) + cutSquare(x/2 + 1, y); } } else { if((y % 2) == 0) { retVal = 1 + (cutSquare(x, y/2) * 2); } else { retVal = 1 + cutSquare(x, y/2) + cutSquare(x, y/2 + 1); } } System.out.println("Returning: " + retVal); return retVal; } }