n = int(eval(input()))

bottom = 10 ** 9+7

person = 0



for _ in range(n):

    a, b = list(map(int, input().split()))

    if b < bottom:

        person = max(person, a)

        bottom = b



ans = person + bottom

print(ans)

import sys

input = sys.stdin.readline

N = int(eval(input()))

ab = [tuple(map(int, input().split())) for _ in range(N)]

ab.sort()

ans = ab[-1][0] - ab[0][0] + 1

ans += ab[0][0] - 1

ans += ab[-1][1]



print(ans)

n = int(eval(input()))
bottom = 10**9 + 7
person = 0
for _ in range(n):
    a, b = list(map(int, input().split()))
    if b < bottom:
        person = max(person, a)
        bottom = b
ans = person + bottom
print(ans)

import sys

input = sys.stdin.readline
N = int(eval(input()))
ab = [tuple(map(int, input().split())) for _ in range(N)]
ab.sort()
ans = ab[-1][0] - ab[0][0] + 1
ans += ab[0][0] - 1
ans += ab[-1][1]
print(ans)

-n = int(eval(input())) -bottom = 10**9 + 7 -person = 0 -for _ in range(n): -    a, b = list(map(int, input().split())) -    if b < bottom: -        person = max(person, a) -        bottom = b -ans = person + bottom +import sys + +input = sys.stdin.readline +N = int(eval(input())) +ab = [tuple(map(int, input().split())) for _ in range(N)] +ab.sort() +ans = ab[-1][0] - ab[0][0] + 1 +ans += ab[0][0] - 1 +ans += ab[-1][1]