#d1501. 社交圈

社交圈

Social Circles

Problem Description

There are NN people. Each person does not want others to sit too close, so he wants LiL_i empty chairs on his left and RiR_i empty chairs on his right; each person himself occupies 11 chair.

Now they will sit in several circles. What is the minimum number of chairs needed (including the chairs each person sits on)?

Input Format

The first line contains an integer NN.

Lines 22 to N+1N+1 each contain two integers LiL_i and RiR_i.

Output Format

One integer: the minimum number of chairs needed.

Sample Input

4
1 2
2 1
3 5
5 3

Sample Output

15

Constraints

1≤N≤1×1051 \le N \le 1 \times 10^5.

0≤Li,Ri≤1×1090 \le L_i, R_i \le 1 \times 10^9.