The main walking trail in Geraldion is absolutely straight, and it passes strictly from the north to the south, it is so long that no one has ever reached its ends in either of the two directions. The Geraldionians love to walk on this path at any time, so the mayor of the city asked the Herald to illuminate this path with a few spotlights. The spotlights have already been delivered to certain places and Gerald will not be able to move them. Each spotlight illuminates a specific segment of the path of the given length, one end of the segment is the location of the spotlight, and it can be directed so that it covers the segment to the south or to the north of spotlight.

The trail contains a monument to the mayor of the island, and although you can walk in either directions from the monument, no spotlight is south of the monument.

You are given the positions of the spotlights and their power. Help Gerald direct all the spotlights so that the total length of the illuminated part of the path is as much as possible.

Input

The first line contains integer n (1 ≤ n ≤ 100) — the number of spotlights. Each of the n lines contains two space-separated integers, ai and li (0 ≤ ai ≤ 108, 1 ≤ li ≤ 108). Number ai shows how much further the i-th spotlight to the north, and number li shows the length of the segment it illuminates.

It is guaranteed that all the ai's are distinct.

Output

Print a single integer — the maximum total length of the illuminated part of the path.

Examples

Input

3
1 1
2 2
3 3


Output

5


Input

4
1 2
3 3
4 3
6 2


Output

9
#include <bits/stdc++.h>
using namespace std;
int N, Ans, F[105][105][2];
struct Nod {
  int x, l;
} A[105];
bool Cmp(Nod a, Nod b) { return a.x < b.x; }
int main() {
  scanf("%d", &N);
  for (int i = 1; i <= N; i++) scanf("%d%d", &A[i].x, &A[i].l);
  sort(A + 1, A + N + 1, Cmp);
  A[0].x = -(1 << 30);
  for (int i = 0; i <= N; i++)
    for (int j = 0; j <= i; j++)
      for (int k = 0; k <= 1; k++) {
        int Pr = A[j].x + k * A[j].l, Max = -1, a, b;
        Ans = max(Ans, F[i][j][k]);
        for (int t = i + 1; t <= N; t++)
          for (int p = 0; p <= 1; p++) {
            int Nr = A[t].x + p * A[t].l;
            if (Nr > Max) Max = Nr, a = t, b = p;
            F[t][a][b] =
                max(F[t][a][b], F[i][j][k] + min(A[t].l, Nr - Pr) + Max - Nr);
          }
      }
  printf("%d\n", Ans);
}
