#include <bits/stdc++.h>
using namespace std;
long long int dp[102][302][302];
bool use[102][302][302];
int n;
vector<long long int> ich;
vector<pair<int, int> > vv;
int L[102];
int R[102];
int B[102];
inline long long int dfs(int b, int lef, int rig) {
  if (b == vv.size()) {
    return 0;
  }
  if (use[b][lef][rig]) {
    return dp[b][lef][rig];
  }
  use[b][lef][rig] = true;
  if (rig != 301 && ich[R[rig]] <= vv[b].first) {
    dp[b][lef][rig] = dfs(b, R[rig], 301);
    return dp[b][lef][rig];
  }
  int empty_l = lef;
  int empty_r = B[b];
  if (rig != 301) {
    empty_r = B[rig];
  }
  { dp[b][lef][rig] = dfs(b + 1, lef, rig); }
  {
    int mr = B[b];
    if (rig != 301) {
      mr = R[rig];
    }
    int U = lef;
    if (rig != 301 || lef == B[b]) {
      U = 301;
    }
    if (ich[R[b]] >= ich[mr])
      dp[b][lef][rig] =
          max(dp[b][lef][rig], dfs(b + 1, U, b) + ich[R[b]] - ich[mr]);
  }
  if (lef != 301) {
    int nex = max(empty_l, L[b]);
    nex = min(nex, empty_r);
    int LL = 301;
    if (rig == 301) {
      LL = B[b];
    }
    dp[b][lef][rig] =
        max(dp[b][lef][rig], dfs(b + 1, LL, rig) + ich[empty_r] - ich[nex]);
  }
  return dp[b][lef][rig];
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a, l;
    scanf("%d%d", &a, &l);
    ich.push_back(a - l);
    ich.push_back(a);
    ich.push_back(a + l);
    vv.push_back(make_pair(a, l));
  }
  ich.push_back(LLONG_MIN);
  sort(ich.begin(), ich.end());
  ich.erase(unique(ich.begin(), ich.end()), ich.end());
  sort(vv.begin(), vv.end());
  for (int i = 0; i < vv.size(); i++) {
    L[i] = lower_bound(ich.begin(), ich.end(), vv[i].first - vv[i].second) -
           ich.begin();
    R[i] = lower_bound(ich.begin(), ich.end(), vv[i].first + vv[i].second) -
           ich.begin();
    B[i] = lower_bound(ich.begin(), ich.end(), vv[i].first) - ich.begin();
  }
  long long int ans = dfs(0, 0, 301);
  printf("%lld\n", ans);
  return 0;
}
