#include <bits/stdc++.h>
using namespace std;
int n, x, y, f[110][110], m, S;
struct N {
  int x, l, r;
  N(int x = 0, int l = 0, int r = 0) : x(x), l(l), r(r) {}
  friend bool operator<(const N &a, const N &b) { return a.x < b.x; }
} a[110];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &x, &y);
    a[i] = N(x, x - y, x + y);
  }
  a[0] = N(-1e8, -1e8, -1e8);
  sort(a + 1, a + n + 1);
  for (int i = 1; i <= n; i++) {
    m = 0;
    for (int j = 0; j < i; j++) {
      int p = max(min(a[j].r, a[i].x), a[i - 1].x);
      p -= a[i - 1].x;
      int g = j;
      if (a[i].r > a[j].r) g = i;
      f[i][g] = max(f[i][g], f[i - 1][j] + p);
    }
    for (int j = i - 1; j >= 0; j--) {
      for (int k = 0; k <= j; k++) {
        int p = max(min(a[k].r, a[i].x), a[j].x);
        int q = max(p, a[i].l);
        p -= a[j].x;
        q = a[i].x - q;
        int g = k;
        if (a[m].r > g) g = m;
        f[i][g] = max(f[i][g], f[j][k] + p + q);
      }
      if (a[j].r > a[m].r) m = j;
    }
  }
  for (int i = 0; i <= n; i++) {
    int p = max(a[i].r, a[n].x) - a[n].x;
    S = max(S, f[n][i] + p);
  }
  printf("%d\n", S);
  return 0;
}
