#include <bits/stdc++.h>
using namespace std;
int n;
vector<pair<int, int> > v;
int sol[200][200][200];
void maximiza(int &maxi, int nuevo) { maxi = max(maxi, nuevo); }
int main() {
  cin >> n;
  v = vector<pair<int, int> >(n);
  for (int i = 0; i < n; i++) cin >> v[i].first >> v[i].second;
  v.push_back(pair<int, int>(-1000000000, 0));
  v.push_back(pair<int, int>(1000000000, 0));
  v.push_back(pair<int, int>(1000000001, 0));
  n += 3;
  sort(v.begin(), v.end());
  for (int i = 0; i < n - 2; i++) {
    for (int j = 0; j <= i; j++) {
      {
        int le = max(0, v[j].first + v[j].second - v[i].first);
        int ri = max(0, v[i + 1].first - (v[i + 1].first - v[i + 1].second));
        int ocupa = min(le + ri, v[i + 1].first - v[i].first);
        for (int d = i + 2; d < n; d++)
          maximiza(sol[i + 1][j][d], sol[i][j][i + 1] + ocupa);
      }
      for (int k = i + 2; k < n; k++) {
        if (v[j].first + v[j].second >= v[i + 1].first + v[i + 1].second)
          maximiza(sol[i + 1][j][k],
                   sol[i][j][k] + v[i + 1].first - v[i].first);
        else {
          int le = max(0, v[j].first + v[j].second - v[i].first);
          int ri = max(0, v[i + 1].first - (v[k].first - v[k].second));
          int ocupa = min(le + ri, v[i + 1].first - v[i].first);
          maximiza(sol[i + 1][i + 1][k], sol[i][j][k] + ocupa);
        }
      }
    }
  }
  int maximo = 0;
  for (int j = 0; j < n - 1; j++) maximo = max(maximo, sol[j][n - 2][n - 1]);
  cout << maximo << endl;
}
