import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); String str[] = in.nextLine().split(" "); long n = Long.parseLong(str[0]); long m = Long.parseLong(str[1]); if(m==1&&n==1){ System.out.println(0); } else if(m==1&&n>1){ System.out.println(n-1); } else if(n==1&&m>1){ System.out.println(m-1); } else { System.out.println((n-1)+n*(m-1)); } } }