def main(): x, y = map(int, input().split()) x2, y2 = map(int, input().split()) ans = max(x, y) if x == y and x2 == y2 and x > x2 and y > y2: ans += 1 print(ans) if __name__ == '__main__': main()