In a game, each player has a distinct positive integer score. Takahashi knows N facts about the players' scores. The i-th fact is that the A_i-th highest score among the players is B_i. The task is to find the maximum possible number of players in the game. Constraints: 1 ≤ N ≤ 10^5, 1 ≤ A_i ≤ 10^9, 0 ≤ B_i ≤ 10^9, A_i ≠ A_j if i ≠ j, and there exists a consistent outcome. The input is given in the format N, followed by N lines of A_i and B_i. The output should be the maximum possible number of players. Example inputs and outputs are provided.

# Buggy version:
N = int(input())
x = 0
ans = 0
for _ in range(N):
    A, B = map(int, input().split())
    if A > x:
        x = A
        ans = B
    print(x+ans)

# Fixed version:
N = int(input())
x = 0
ans = 0
for _ in range(N):
    A, B = map(int, input().split())
    if A > x:
        x = A
        ans = B
print(x+ans)

# Buggy version:
N = int(input())
mini1 = 0
mini2 = 0
for i in range(N):
  MM = input().split()
  a = int(MM[0])
  b = int(MM[1])
  if a > mini1:
    mini1 = a
    mini2 = b
print(a+b)

# Fixed version:
N = int(input())
mini1 = 0
mini2 = 0
for i in range(N):
  MM = input().split()
  a = int(MM[0])
  b = int(MM[1])
  if a > mini1:
    mini1 = a
    mini2 = b
    
print(mini1 + mini2)

# Buggy version:
N = int(input())
M = 0
m = 10**9
c = 0
for i in range(N):
  a,b = map(int.input().split())
  if m >= a:
    m = a
  if M < a:
    M = a
    c = b + 1
print(c+m-M)

# Fixed version:
N = int(input())
M = 0
m = 10**9
c = 0
for i in range(N):
  a,b = map(int,input().split())
  if m >= a:
    m = a
  if M < a:
    M = a
    c = b + 1
ans = c+M-1
print(ans)

# Buggy version:
n = int(input())
ans = 0
now = -1
for i in range(n):
  a,b = map(int,input().split())
  if a > now:
    ans = a + b

print(ans)

# Fixed version:
n = int(input())
ans = 0
now = -1
for i in range(n):
  a,b = map(int,input().split())
  if a > now:
    now = a
    ans = a + b

print(ans)

# Buggy version:
#!/usr/bin/env python3
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right

def main():
    N = int(input())
    A = [None] * N
    B = [None] * N
    for i in range(N):
        A[i], B[i] = map(int, input().split())
    print(max(A[i])+B.index(max(A[i])))

if __name__ == "__main__":
    main()


# Fixed version:
#!/usr/bin/env python3
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right

def main():
    N = int(input())
    A = [None] * N
    B = [None] * N
    for i in range(N):
        A[i], B[i] = map(int, input().split())
    print(max(A)+B[A.index(max(A))])

if __name__ == "__main__":
    main()

# Buggy version:
n=int(input())
a=0
ans=0
for i in range(n):
  x,y=map(int,input().split())
  if a<x:
    ans=x+y-1
    a=x
print(ans)

# Fixed version:
n=int(input())
a=0
ans=0
for i in range(n):
  x,y=map(int,input().split())
  if a<x:
    ans=x+y
    a=x
print(ans)

# Buggy version:
n = int(input())
A = []
B = []
for i in range(n):
  a, b = map(int,input().split())
  A.append(a)
  B.append(b)
print(max(a)+min(b))

# Fixed version:
N = int(input())
a, b = [], []
for i in range(N):
    A, B = map(int, input().split())
    a.append(A)
    b.append(B)
print(max(a)+min(b))

# Buggy version:
N = int(input())

maxi = -1
sc = 0

for i in range(N):
	A, B = map(int, input().split())
	if A > mini:
		mini = A
		sc = B
print(mini + sc)


# Fixed version:
N = int(input())

maxi = -1
sc = 0

for i in range(N):
	A, B = map(int, input().split())
	if A > maxi:
		maxi = A
		sc = B
print(maxi + sc)

# Buggy version:
from operator import itemgetter


n = int(input())
info = [list(map(int, input().split())) for i in range(n)]

info = sorted(info, key = itemgetter(1))
print(info[0][0] + info[0][])

# Fixed version:
from operator import itemgetter


n = int(input())
info = [list(map(int, input().split())) for i in range(n)]

info = sorted(info, key = itemgetter(1))
print(info[0][0] + info[0][1])

# Buggy version:
n=int(input())
a=sorted(list(map(int,input().split())) for _ in range(n))
print(sum(a[-1])

# Fixed version:
n = int(input())
a = sorted([list(map(int, input().split())) for _ in range(n)])
print(sum(a[-1]))

# Buggy version:
# tenka1-2017-beginnerB - Different Distribution
def main():
    N, *AB = map(int, open(0).read().split())
    A = [sum(i, j) for i, j in zip(*[iter(AB)] * 2)]
    ans == max(A)
    print(ans)


if __name__ == "__main__":
    main()

# Fixed version:
# tenka1-2017-beginnerB - Different Distribution
def main():
    N, *AB = map(int, open(0).read().split())
    A = [(i, j) for i, j in zip(*[iter(AB)] * 2)]
    A.sort()
    ans = sum(A[-1])
    print(ans)


if __name__ == "__main__":
    main()

# Buggy version:
N,*A=map(int,open(0).read().split())
i=2*sorted(enumerate(A[::2]),lambda x:x[1])[-1][0]
print(A[i]+A[i+1])

# Fixed version:
N,*A=map(int,open(0).read().split())
i=2*sorted(enumerate(A[::2]),key=lambda x:x[1])[-1][0]
print(A[i]+A[i+1])

# Buggy version:
n=int(input())
l=[list(map(int,input().split())) for _ in range(n)]
print(sum(l[-1]))

# Fixed version:
n=int(input())
print(sum(sorted([list(map(int,input().split())) for _ in range(n)])[-1]))

# Buggy version:
n = int(input())
point_list = sorted([[ int(v) for v in input().split() ] for i in range(n) ])
print(point_list[0][0]+point_list[0][1])


# Fixed version:

n = int(input())
point_list = sorted([[ int(v) for v in input().split() ] for i in range(n) ])
print(point_list[-1][0]+point_list[-1][1])

# Buggy version:
n = int(input())
a = 0
for i in range(n):
    a1,b1 = map(int,input().split())
    if a < a1:
        a = a1
        b = b1
print(a + b-1)

# Fixed version:
n = int(input())
a = 0
b = 0
for i in range(n):
    a1,b1 = map(int,input().split())
    if a < a1:
        a = a1
        b = b1
print(a+b)

# Buggy version:
n = int(input())
A = [None] * n
B = [None] * n
for i in range(n):
    A[i], B[i] = list(map(int, input().split()))

print(A[B.index(min_point)] + min(B))

# Fixed version:
n = int(input())
A = [None] * n
B = [None] * n
for i in range(n):
    A[i], B[i] = list(map(int, input().split()))

print(A[B.index(min(B))] + min(B))

# Buggy version:
n,*a=map(int,read(0).split())
b=max([a[i]for i in range(0,len(a),2)])
print(b+a[a.index(b)+1])

# Fixed version:
n,*a=map(int,open(0).read().split())
b=[a[i]for i in range(0,len(a),2)]
c=[a[i]for i in range(1,len(a),2)]
print(max(b)+c[b.index(max(b))])

# Buggy version:

n = int(input())
temp = 0
ans = 0
for i in range(n):
    a,b = map(int,input().split(' '))
    if a > temp:
        ans = a + b
print ans

# Fixed version:

n = int(input())
temp = 0
ans = 0
for i in range(n):
    a,b = map(int,input().split(' '))
    if a > temp:
        ans = a + b
        temp = a
print(ans)

# Buggy version:
n=int(input())
a=[0]*n
b=[0]*n
for i in range(n):
    a[i],b[i]=map(int,input().split())
y=max(a)
print(y+b[y])

# Fixed version:
n=int(input())
a=[0]*n
b=[0]*n
for i in range(n):
    a[i],b[i]=map(int,input().split())
y=max(a)
print(y+b[a.index(y)])

# Buggy version:
n = int(input())
a =0
b =0
for i in range(n):
    nums = [int(num) for num in input().split]
    aa = nums[0]
    bb = nums[1]
    if aa > a:
        a = aa
        b = bb
print(a + b)
    

# Fixed version:
n = int(input())
a =0
b =0
for i in range(n):
    nums = [int(num) for num in input().split()]
    aa = nums[0]
    bb = nums[1]
    if aa > a:
        a = aa
        b = bb
print(a + b)

# Buggy version:
n = int(input())

maxm = 0
num = -1

for i in range():
    a, b = map(int, input().split())
    if a > maxm:
        maxm = a
        num = b

print(maxm + num)

# Fixed version:
n = int(input())

maxm = 0
num = -1

for i in range(n):
    a, b = map(int, input().split())
    if a > maxm:
        maxm = a
        num = b

print(maxm + num)

# Buggy version:
n = int(input())

p = 0
s = 0

for i in range(n):
    a,b = [int(x) for x in input().split()]
    if p < a:
        p, s = a, b
    else:
        pass

print(a+b)

# Fixed version:
n = int(input())

p = 0
s = 0

for i in range(n):
    a,b = [int(x) for x in input().split()]
    if i == 0:
        p,s = a,b
    else:
        if a > p:
            p,s = a,b
        else:
            pass

print(p+s)

# Buggy version:
N = int(input())
dic = {}
for i in range(N):
    a,b = [int(j) for j in input().split(" ")]
    dic[a] = b
ans = len(dic)
max_keys = max(dic.keys())
min_value = dic[max_keys]
print(ans + min_value)

# Fixed version:
N = int(input())
dic = {}
for i in range(N):
    a,b = [int(j) for j in input().split(" ")]
    dic[a] = b
max_keys = max(dic.keys())
min_value = dic[max_keys]
print(max_keys+min_value)

# Buggy version:
#!user/bin/env python
# coding:utf-8

n = int(input())
info = []

for i in range(n):
    ai = int(input())
    bi = int(input())
    info.append([ai, bi])

info = sorted(info, key=lambda inf: inf[1])

imp = info[0][0] + info[0][1]
print(imp)

# Fixed version:
#!user/bin/env python
# coding:utf-8

n = int(input())
info = []

for i in range(n):
    # ai = int(input())
    # bi = int(input())
    abi = input()
    ai, bi = int(abi.split(' ')[0]), int(abi.split(' ')[1])
    
    info.append([ai, bi])

info = sorted(info, key=lambda inf: inf[1])

imp = info[0][0] + info[0][1]
print(imp)

# Buggy version:
N = int(input())
A = []
B = []
for i in range(N):
  a, b = map(int, input().split())
  A.append(a)
  B.append(b)
print(max(A)+B[A.index(min(A))])

# Fixed version:
N = int(input())
A = []
B = []
for i in range(N):
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)

res = max(A)
res += min(B)

print(res)

# Buggy version:
N = int(input())
A = []
B = []
for i in range(N):
  a, b = map(int, input().split())
  A.append(a)
  B.append(b)
print(min(A)+B[A.index(min(A))])

# Fixed version:
N = int(input())
A = []
B = []
for i in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
print(B[A.index(max(A))]+max(A))

# Buggy version:
n=int(input())

max=0
for i in range(n):
    a,b=map(int,input().split())
    if a>max: ans=a+b

print(ans)

# Fixed version:
n=int(input())

max=0
for i in range(n):
    a,b=map(int,input().split())
    if a>max: max=a; ans=a+b

print(ans)