A,B = map(int, input().split()) if A==B==1: print(2) exit() A,B = max(A,B),min(A,B) same = A-B not_same = A+B-same for i in range(B): if same