#include <bits/stdc++.h>
using namespace std;
const int N = 105;
int n, ans, f[N][N][2];
struct node {
  int x, len;
} line[N];
bool cmp(node a, node b) { return a.x < b.x; }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &line[i].x, &line[i].len);
  }
  sort(line + 1, line + n + 1, cmp);
  line[0] = (node){(int)(-1e9), 0};
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= i; j++) {
      for (int p = 0; p <= 1; p++) {
        ans = max(ans, f[i][j][p]);
        int r = line[j].x + p * line[j].len;
        int nR = -1e9, nk = 0, nq = 0;
        for (int k = i + 1; k <= n; k++) {
          for (int q = 0; q <= 1; q++) {
            int R = line[k].x + q * line[k].len;
            if (nR < R) {
              nR = R, nk = k, nq = q;
            }
            f[k][nk][nq] = max(f[k][nk][nq],
                               f[i][j][p] + min(line[k].len, R - r) + nR - R);
          }
        }
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
