#include <bits/stdc++.h>
using namespace std;
pair<int, int> p[100];
int n, x[3000];
int t[101][101][300];
unordered_map<int, int> d;
long long q[301][301];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++)
    cin >> p[i].first >> p[i].second, p[i].first += 2e8;
  sort(p, p + n);
  for (int i = 0; i < n; i++)
    x[i] = p[i].first - p[i].second, x[i + n] = p[i].first,
    x[i + 2 * n] = p[i].first + p[i].second;
  int m = 3 * n;
  sort(x, x + m);
  for (int i = 0; i < m; i++) d[x[i]] = i;
  for (int l = 0; l < n; l++) {
    t[l][l][d[p[l].first]] = p[l].first + p[l].second;
    t[l][l][d[p[l].first - p[l].second]] = p[l].first;
    for (int r = l + 1; r < n; r++) {
      for (int k = 0; k < m && x[k] <= p[l].first; k++) {
        if (t[l][r - 1][k] >= p[r].first)
          t[l][r][k] = max(t[l][r - 1][k], p[r].first + p[r].second);
        if (p[r].first - p[r].second == x[k]) {
          t[l][r][k] = max(t[l][r][k], p[r].first);
          for (int j = l; j < r; j++)
            t[l][r][k] = max(t[l][r][k], p[j].first + p[j].second);
        } else if (p[r].first - p[r].second > x[k]) {
          int cur = p[r].first;
          for (int j = r - 1; j >= l; j--) {
            if (t[l][j][k] >= p[r].first - p[r].second)
              t[l][r][k] = max(t[l][r][k], max(cur, t[l][j][k]));
            cur = max(p[j].first + p[j].second, cur);
          }
        }
      }
    }
  }
  long long res = 0;
  for (int i = n - 1; i >= 0; i--) {
    for (int j = 0; j < m; j++) {
      for (int k = i; k < n; k++) {
        if (t[i][k][j]) {
          if (k == n - 1)
            q[i][j] = max(q[i][j], (long long)t[i][k][j] - x[j]);
          else
            for (int c = d[t[i][k][j]]; c < m; c++)
              if (q[k + 1][c])
                q[i][j] = max(q[i][j], q[k + 1][c] + t[i][k][j] - x[j]);
        }
      }
    }
  }
  for (int i = 0; i < m; i++) res = max(res, q[0][i]);
  cout << res << endl;
  return 0;
}
