#include <bits/stdc++.h>
using namespace std;
const int N = 100;
int a[N];
int l[N];
int n;
int debug = 0;
map<int, int> _next_i;
int next_i(int x) {
  if (_next_i.count(x)) return _next_i[x];
  for (int i = 0; i < n; i++) {
    if (x <= a[i]) return _next_i[x] = i;
  }
  return _next_i[x] = n;
}
int length(pair<int, int> I) {
  assert(I.first <= I.second);
  return I.second - I.first;
}
pair<int, int> intersect(pair<int, int> I, pair<int, int> J) {
  assert(max(I.first, J.first) <= min(I.second, J.second));
  return make_pair(max(I.first, J.first), min(I.second, J.second));
}
int left(int i) { return a[i] - l[i]; }
int right(int i) { return a[i] + l[i]; }
ostream &operator<<(ostream &out, pair<int, int> I) {
  return out << "(" << I.first << ", " << I.second << ")";
}
int intersectionlength(pair<int, int> I, pair<int, int> J) {
  return max(0, min(I.second, J.second) - max(I.first, J.first));
}
pair<int, int> range_l(pair<int, int> I, int k, pair<int, int> S) {
  int minl = -1;
  int maxr = -1;
  for (int i = 0; i < (n); i++)
    if (S.first <= a[i] && a[i] <= S.second && I.first < a[i] &&
        a[i] < I.second) {
      if (i != k && (minl == -1 || left(i) < left(minl))) minl = i;
    }
  for (int i = 0; i < (n); i++)
    if (S.first <= a[i] && a[i] <= S.second && I.first < a[i] &&
        a[i] < I.second) {
      if (i != minl && i != k && (maxr == -1 || right(i) > right(maxr)))
        maxr = i;
    }
  if (0)
    cout << "minl"
         << " = " << minl << endl;
  int left_end =
      max(I.first, (minl == -1) ? S.first : min(S.first, left(minl)));
  int right_end =
      min(I.second, (maxr == -1) ? S.second : max(S.second, right(maxr)));
  if (0)
    cout << "left_end"
         << " = " << left_end << endl;
  for (int i = (n)-1; i >= (0); --i)
    if (i != k && I.first < a[i] && a[i] < I.second && left_end <= a[i] &&
        a[i] < S.first) {
      left_end = min(left_end, left(i));
      if (0)
        cout << "i"
             << " = " << i << endl;
      if (0)
        cout << "left_end"
             << " = " << left_end << endl;
    }
  for (int i = (0); i < (n); i++)
    if (i != k && I.first < a[i] && a[i] < I.second && S.second < a[i] &&
        a[i] <= right_end) {
      right_end = max(right_end, right(i));
      if (0)
        cout << "left_end"
             << " = " << left_end << endl;
    }
  if (debug)
    cout << "range_l(" << I << ", " << k << ", " << S
         << ") = " << make_pair(left_end, right_end) << endl;
  return intersect(I, make_pair(left_end, right_end));
}
pair<int, int> range_r(pair<int, int> I, int k, pair<int, int> S) {
  int minl = -1;
  int maxr = -1;
  for (int i = 0; i < (n); i++)
    if (S.first <= a[i] && a[i] <= S.second && I.first < a[i] &&
        a[i] < I.second) {
      if (i != k && (maxr == -1 || right(i) > right(maxr))) maxr = i;
    }
  for (int i = 0; i < (n); i++)
    if (S.first <= a[i] && a[i] <= S.second && I.first < a[i] &&
        a[i] < I.second) {
      if (i != maxr && i != k && (minl == -1 || left(i) < left(minl))) minl = i;
    }
  int left_end =
      max(I.first, (minl == -1) ? S.first : min(S.first, left(minl)));
  int right_end =
      min(I.second, (maxr == -1) ? S.second : max(S.second, right(maxr)));
  for (int i = (n)-1; i >= (0); --i)
    if (i != k && I.first < a[i] && a[i] < I.second && left_end <= a[i] &&
        a[i] < S.first)
      left_end = min(left_end, left(i));
  for (int i = (0); i < (n); i++)
    if (i != k && I.first < a[i] && a[i] < I.second && S.second < a[i] &&
        a[i] <= right_end)
      right_end = max(right_end, right(i));
  if (debug)
    cout << "range_r(" << I << ", " << k << ", " << S
         << ") = " << make_pair(left_end, right_end) << endl;
  return intersect(I, make_pair(left_end, right_end));
}
bool in(int x, pair<int, int> I) { return I.first < x && x < I.second; }
map<pair<int, int>, int> _solve;
int solve(pair<int, int> I) {
  if (I.first >= I.second) return 0;
  if (_solve.count(I)) return _solve[I];
  int k = -1;
  for (int i = 0; i < (n); i++)
    if (I.first < a[i] && a[i] < I.second) {
      if (k == -1 || l[i] > l[k]) {
        k = i;
      }
    }
  if (k == -1) {
    if (debug) cout << "solve" << I << " = 0" << endl;
    return _solve[I] = 0;
  }
  vector<pair<int, int> > Js;
  pair<int, int> leftI = intersect(I, make_pair(left(k), a[k]));
  Js.push_back(range_l(I, k, leftI));
  Js.push_back(range_r(I, k, leftI));
  pair<int, int> rightI = intersect(I, make_pair(a[k], right(k)));
  Js.push_back(range_l(I, k, rightI));
  Js.push_back(range_r(I, k, rightI));
  int score = 0;
  for (pair<int, int> J : Js) {
    assert(J.second - J.first > 0 && I.first <= J.first &&
           J.second <= I.second);
    score = max(score, solve(make_pair(I.first, J.first)) + J.second - J.first +
                           solve(make_pair(J.second, I.second)));
  }
  if (debug)
    for (pair<int, int> J : Js) {
      if (score == solve(make_pair(I.first, J.first)) + J.second - J.first +
                       solve(make_pair(J.second, I.second)))
        cout << "*";
      cout << J << " ";
    }
  if (debug) cout << endl << "solve" << I << " = " << score << endl;
  return _solve[I] = score;
}
struct spotlight {
  int a;
  int l;
} spotlights[N];
bool operator<(spotlight u, spotlight v) { return u.a < v.a; }
int main() {
  assert(scanf("%d", &n) == 1);
  for (int i = 0; i < (n); i++)
    assert(scanf("%d%d", &spotlights[i].a, &spotlights[i].l) == 2);
  sort(spotlights, spotlights + n);
  for (int i = 0; i < (n); i++) {
    a[i] = spotlights[i].a;
    l[i] = spotlights[i].l;
  }
  a[n] = 2e8;
  printf("%d\n", solve(make_pair(-1e8, 2e8)));
}
