import java.io.*; import java.util.*; public class Solution { static HashMap h = new HashMap(); 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 sc = new Scanner(System.in); int m = sc.nextInt(); int n = sc.nextInt(); //dp=new long[m+1][n+1]; System.out.println(rec(m,n)); } static long rec(int m,int n){ Node nn = new Node(m,n); if(h.containsKey(nn)) return h.get(nn); long temp=0; if(m==1 || n==1) temp=(m-1)*n + (n-1)*m; else if(m