#include <bits/stdc++.h>
using namespace std;
inline long long rd() {
  long long _x = 0;
  int _ch = getchar(), _f = 1;
  for (; !isdigit(_ch) && (_ch != '-') && (_ch != EOF); _ch = getchar())
    ;
  if (_ch == '-') {
    _f = 0;
    _ch = getchar();
  }
  for (; isdigit(_ch); _ch = getchar()) _x = _x * 10 + _ch - '0';
  return _f ? _x : -_x;
}
void write(long long _x) {
  if (_x >= 10)
    write(_x / 10), putchar(_x % 10 + '0');
  else
    putchar(_x + '0');
}
inline void wrt(long long _x, char _p) {
  if (_x < 0) putchar('-'), _x = -_x;
  write(_x);
  if (_p) putchar(_p);
}
int dp[105][105][2];
int n;
struct node {
  int a, len;
  bool operator<(const node &B) const { return a < B.a; }
} w[105];
int main() {
  n = rd();
  for (int i = int(1); i <= (int)(n); i++) w[i].a = rd(), w[i].len = rd();
  sort(w + 1, w + 1 + n);
  w[0].a = -1e8;
  int ans = 0;
  for (int i = int(0); i <= (int)(n); i++) {
    for (int j = int(0); j <= (int)(i); j++) {
      for (int k = int(0); k <= (int)(1); k++) {
        ans = max(ans, dp[i][j][k]);
        int R = w[j].a + k * w[j].len;
        int mx = -1e8, right, p;
        for (int nx = int(i + 1); nx <= (int)(n); nx++) {
          for (int t = int(0); t <= (int)(1); t++) {
            int Rnx = w[nx].a + t * w[nx].len;
            if (Rnx > mx) mx = Rnx, right = nx, p = t;
            dp[nx][right][p] =
                max(dp[nx][right][p],
                    dp[i][j][k] + min(Rnx - R, w[nx].len) + mx - Rnx);
          }
        }
      }
    }
  }
  wrt(ans, '\n');
}
