import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Yo int newM=m-m/2; int newN=n-n/2; ur class should be named Solution. */ Scanner s=new Scanner(System.in); long n=s.nextLong(); long m=s.nextLong(); long out=0; if(n==1) out= m-1; if(m==1) out= n-1; long row=(n-1)+(m-1)*n; long col=m-1+(n-1)*m; if(row>col) out=col; else out=row; System.out.println(out); } }