#include <bits/stdc++.h>
using namespace std;
int solve(int f, int xf, vector<pair<int, int> > &L,
          map<pair<int, int>, int> &ans) {
  auto it = ans.find(make_pair(f, xf));
  if (it != ans.end()) return it->second;
  int N = L.size();
  if (f == N) return 0;
  int ret = solve(f + 1, max(xf, L[f].first + L[f].second), L, ans) +
            max(0, L[f].first + L[f].second - max(xf, L[f].first));
  vector<int> pm(N - f + 1, 0);
  for (int i = f; i < N; i++)
    pm[i - f + 1] = max(pm[i - f], L[i].first + L[i].second);
  vector<pair<int, int> > V(N - f);
  for (int i = f; i < N; i++)
    V[i - f].first = L[i].first - L[i].second, V[i - f].second = i;
  sort(begin(V), end(V));
  for (int i = 0; i < N - f; i++) {
    int r = max(xf, L[V[i].second].first);
    r = max(r, pm[V[i].second - f]);
    int akt = solve(V[i].second + 1, max(xf, r), L, ans);
    akt += max(0, r - max(xf, V[i].first));
    ret = max(ret, akt);
  }
  ans[make_pair(f, xf)] = ret;
  return ret;
}
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(10);
  int N;
  cin >> N;
  vector<pair<int, int> > L(N);
  for (int i = 0; i < N; i++) cin >> L[i].first >> L[i].second;
  sort(begin(L), end(L));
  map<pair<int, int>, int> ans;
  cout << solve(0, -100000000, L, ans) << "\n";
  return 0;
}
