#!/usr/bin/env python3

N = int(eval(input()))

ab = [[0, 0] for _ in range(N)]

for i in range(N):

    ab[i] = list(map(int, input().split()))

ab.sort(key=lambda x:x[0])



ans = ab[0][0]

for i in range(N)[1::]:

    ans += min(ab[i][0] - ab[i-1][0], ab[i-1][1] - ab[i][1])

ans += ab[-1][1]



print(ans)

#!/usr/bin/env python3

N = int(eval(input()))

A = [0] * N

B = [0] * N

for i in range(N):

    A[i], B[i] = list(map(int, input().split()))



idx = A.index(max(A))

print((A[idx] + B[idx]))

#!/usr/bin/env python3
N = int(eval(input()))
ab = [[0, 0] for _ in range(N)]
for i in range(N):
    ab[i] = list(map(int, input().split()))
ab.sort(key=lambda x: x[0])
ans = ab[0][0]
for i in range(N)[1::]:
    ans += min(ab[i][0] - ab[i - 1][0], ab[i - 1][1] - ab[i][1])
ans += ab[-1][1]
print(ans)

#!/usr/bin/env python3
N = int(eval(input()))
A = [0] * N
B = [0] * N
for i in range(N):
    A[i], B[i] = list(map(int, input().split()))
idx = A.index(max(A))
print((A[idx] + B[idx]))

-ab = [[0, 0] for _ in range(N)] +A = [0] * N +B = [0] * N -    ab[i] = list(map(int, input().split())) -ab.sort(key=lambda x: x[0]) -ans = ab[0][0] -for i in range(N)[1::]: -    ans += min(ab[i][0] - ab[i - 1][0], ab[i - 1][1] - ab[i][1]) -ans += ab[-1][1] -print(ans) +    A[i], B[i] = list(map(int, input().split())) +idx = A.index(max(A)) +print((A[idx] + B[idx]))