x, y = map(int, input().split()) x2, y2 = map(int, input().split()) if abs(x2) == abs(y2): ans = max(x, y) + 1 else: ans = max(x, y) print(ans)