# verification-helper: PROBLEM https://yukicoder.me/problems/no/208 def main() -> None: x, y = map(int, input().split()) x2, y2 = map(int, input().split()) print(min(x, y) + abs(x - y)) if __name__ == "__main__": main()