n,*t=list(map(int,open(0).read().split()));print((sum(sorted(zip(t[::2],t[1::2]))[-1])))
n,*t=list(map(int,open(0).read().split()));print((sum(max(list(zip(t[::2],t[1::2]))))))
n, *t = list(map(int, open(0).read().split()))
print((sum(sorted(zip(t[::2], t[1::2]))[-1])))

n, *t = list(map(int, open(0).read().split()))
print((sum(max(list(zip(t[::2], t[1::2]))))))

-print((sum(sorted(zip(t[::2], t[1::2]))[-1]))) +print((sum(max(list(zip(t[::2], t[1::2]))))))