#include <bits/stdc++.h>
using namespace std;
const int INF = (1 << 30);
const int maxn = 100 + 5;
template <typename T>
inline void getmax(T& a, T b) {
  if (b > a) a = b;
}
struct P {
  int x, y;
  bool operator<(const P& rhs) const {
    return x == rhs.x ? y > rhs.y : x < rhs.x;
  }
};
void normalize(vector<P>& vec) {
  sort(vec.begin(), vec.end());
  int sz = 0;
  for (int i = 0; i < vec.size(); i++)
    if (!sz || vec[sz - 1].y < vec[i].y) vec[sz++] = vec[i];
  vec.resize(sz);
}
vector<int> disc;
inline int ID(int x) {
  return lower_bound(disc.begin(), disc.end(), x) - disc.begin();
}
inline void solve(vector<P>& L, vector<P>& R, vector<P>& res) {
  for (const P& now : L) {
    int id = lower_bound(R.begin(), R.end(), (P){now.y, -INF}) - R.begin();
    if (!id || R[--id].y < now.x) continue;
    res.push_back((P){min(now.x, R[id].x), max(now.y, R[id].y)});
  }
}
vector<P> seg[maxn][maxn];
P a[maxn];
int dp[maxn][3 * maxn];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &a[i].x, &a[i].y);
    for (int j = -1; j < 2; j++) disc.push_back(a[i].x + j * a[i].y);
  }
  sort(a + 1, a + n + 1);
  sort(disc.begin(), disc.end());
  disc.resize(unique(disc.begin(), disc.end()) - disc.begin());
  for (int i = n; i >= 1; i--)
    for (int j = i; j <= n; j++) {
      if (i == j) {
        seg[i][j].push_back((P){ID(a[i].x - a[i].y), ID(a[i].x)});
        seg[i][j].push_back((P){ID(a[i].x), ID(a[i].x + a[i].y)});
        continue;
      }
      for (int k = i; k < j; k++)
        solve(seg[i][k], seg[k + 1][j], seg[i][j]),
            solve(seg[k + 1][j], seg[i][k], seg[i][j]);
      normalize(seg[i][j]);
    }
  for (int R = 1; R <= n; R++)
    for (int rp = 0; rp < disc.size(); rp++) {
      for (int L = 0; L < R; L++)
        for (const P& now : seg[L + 1][R]) {
          if (now.y > rp) break;
          getmax(dp[R][rp], dp[L][now.x] + disc[now.y] - disc[now.x]);
        }
    }
  int ans = 0;
  for (int i = 0; i < disc.size(); i++) getmax(ans, dp[n][i]);
  assert(ans == dp[n][disc.size() - 1]);
  printf("%d\n", dp[n][disc.size() - 1]);
}
