import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { 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 scan = new Scanner(System.in); long i = scan.nextLong(); long j = scan.nextLong(); long count = 0; long count1 = 0; if(i==1){ count = j - 1; System.out.println(count); } else if(j==1){ count = i - 1; System.out.println(count); } else{ if(i