#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    x = (x << 1) + (x << 3) + ch - '0', ch = getchar();
  return x * f;
}
int ans, n, aa, bb, nxt, last, mx, f[105][105][2];
struct node {
  int x, l;
} a[105];
bool cmp(const node &A, const node &B) { return A.x < B.x; }
int main() {
  n = read();
  for (int i = 1; i <= n; i++) a[i].x = read(), a[i].l = read();
  sort(a + 1, a + n + 1, cmp);
  a[0].x = -inf;
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= i; j++)
      for (int k = 0; k <= 1; k++) {
        ans = max(ans, f[i][j][k]);
        last = a[j].x + a[j].l * k;
        mx = -1;
        for (int l = i + 1; l <= n; l++)
          for (int v = 0; v <= 1; v++) {
            nxt = a[l].x + a[l].l * v;
            if (nxt > mx) mx = nxt, aa = l, bb = v;
            f[l][aa][bb] = max(f[l][aa][bb],
                               f[i][j][k] + min(nxt - last, a[l].l) + mx - nxt);
          }
      }
  printf("%d\n", ans);
  return 0;
}
