import java.util.Scanner; public class PaperCutting { public static void main(String[] args) { Scanner s = new Scanner(System.in); long n = s.nextLong(); long m = s.nextLong(); long a = (n-1)+(n*(m-1)); long b = (m-1)+(m*(n-1)); System.out.println(Math.min(a, b)); } }