local n, m = io.read'*n', io.read'*n' print(n + m + math.max(0, math.abs(n - m - 1)))