import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) { PrintWriter output = new PrintWriter(System.out); new Solution().processInput(new Scanner(System.in), output); output.flush(); } public void processInput(Scanner in, PrintWriter output) { long n = in.nextInt(); // long m = in.nextInt(); long nCuts = n - 1; long mCuts = (m - 1) * n; long x = nCuts + mCuts; mCuts = m - 1; nCuts = (n - 1) * m; long y = nCuts + mCuts; output.println(Math.min(x,y)); } }