import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ Scanner m1=new Scanner(System.in); long n=m1.nextLong(); long m=m1.nextLong(); long temp1=0; long temp2=0; if(n-1>0){ temp1=(n-1)*m; }else{ temp1=-1; } if(m-1>0){ temp2=(m-1)*n; }else{ temp2=-1; } if(temp1<temp2){ if(temp1==-1){ System.out.println(temp2); } else{ System.out.println(temp1); } }else{ if(temp2==-1){ System.out.println(temp1); }else{ System.out.println(temp2); } } } }