#TENKA12017B. Different Distribution

Different Distribution

Score : 200200 points

Problem Statement

A group of people played a game. All players had distinct scores, which are positive integers.

Takahashi knows NN facts on the players' scores. The ii-th fact is as follows: the AiA_i-th highest score among the players is BiB_i.

Find the maximum possible number of players in the game.

Constraints

  • 1N1051 \leq N \leq 10^5
  • 1Ai109(1iN)1 \leq A_i \leq 10^9(1\leq i\leq N)
  • 0Bi109(1iN)0 \leq B_i \leq 10^9(1\leq i\leq N)
  • If iji \neq j, AiAjA_i \neq A_j.
  • There exists a possible outcome of the game that are consistent with the facts.
  • All input values are integers.

Inputs

Input is given from Standard Input in the following format:

NN

A1A_1 B1B_1

:

ANA_N BNB_N

Outputs

Print the maximum possible number of players in the game.

3
4 7
2 9
6 2
8

The maximum possible number of players is achieved when, for example, the players have the following scores: 12,9,8,7,5,2,1,012,9,8,7,5,2,1,0.

5
1 10
3 6
5 2
4 4
2 8
7
2
1 1000000000
1000000000 1
1000000001