题目描述
Problem Description
Some people played a game. The scores of all people were different non-negative integers.
Takahashi has $ N $ pieces of information. The $ i $-th piece of information indicates that the score of the $ A_i $-th highest scorer was $ B_i $ points.
Find the maximum possible number of participants in the game.
Input Format
The input is given from the standard input in the following format:
$ N $ $ A_1 $ $ B_1 $ : $ A_N $ $ B_N $
Output Format
Output the maximum possible number of participants in the game.
Sample Input and Output
Sample Input #1
3
4 7
2 9
6 2
Sample Output #1
8
Sample Input #2
5
1 10
3 6
5 2
4 4
2 8
Sample Output #2
7
Sample Input #3
2
1 1000000000
1000000000 1
Sample Output #3
1000000001
Notes/Hints
Constraints
- $1 \leq N \leq 10^5$
- $1 \leq A_i \leq 10^9 (1 \leq i \leq N)$
- $0 \leq B_i \leq 10^9 (1 \leq i \leq N)$
- $A_i \neq A_j$ if $i \neq j$
- It is guaranteed that there exists a set of scores that satisfies all given conditions.
- All inputs are integers.
Sample Explanation 1
One example that achieves the maximum number of participants is having the scores in descending order as $ 12, 9, 8, 7, 5, 2, 1, 0 $.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分
样例输入
3
4 7
2 9
6 2
样例输出
8