import itertools A,B = map(int,input().split()) AB = [0] * A + [1] * B ans = 0 for x in itertools.permutations(AB): prev = -1 p = 0 for s in x: if prev != s: p += 1 prev = s ans = max(ans,p) print(ans)