import java.util.*; import java.math.*; import java.io.*; import java.text.DecimalFormat; import java.math.BigInteger; public class Main{ //static int d=20; static long mod=1000000007 ; //static HashMap hm=new HashMap<>(); static ArrayList> arr; static int size; static long[][] fac; static long[][] dp; static int num,max; static int ans=0; static HashMap hm; public static void main(String[] args) throws IOException { boolean online =false; String fileName = "C-large"; PrintWriter out; if (online) { s.init(new FileInputStream(new File(fileName + ".in"))); out= new PrintWriter(new FileWriter(fileName + "out.txt")); } else { s.init(System.in); out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); } long n,m,ans; n=s.nl(); m=s.nl(); ans=Math.min(n-1+n*(m-1),m-1+m*(n-1)); out.println(ans); out.close(); } static class edge implements Comparable{ int from,to,c,d,id; public edge(int x,int y,int u,int v,int z){ from=x; to=y; c=u; d=v; id=z; } public int compareTo(edge o){ return c-o.c; } } public static class s { static BufferedReader reader; static StringTokenizer tokenizer; /** call this method to initialize reader for InputStream */ static void init(InputStream input) { reader = new BufferedReader( new InputStreamReader(input) ); tokenizer = new StringTokenizer(""); } /** get next word */ static String ns() throws IOException { while ( ! tokenizer.hasMoreTokens() ) { //TODO add check for eof if necessary tokenizer = new StringTokenizer( reader.readLine() ); } return tokenizer.nextToken(); } static int ni() throws IOException { return Integer.parseInt( ns() ); } static double nd() throws IOException { return Double.parseDouble( ns() ); } static long nl() throws IOException { return Long.parseLong( ns() ); } } }