#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e17;
struct node {
  long long pos, l;
  bool operator<(const node& x) const { return pos < x.pos; }
} a[320];
int n, cnt, tmp;
long long f[320][320][2], ans, mx, to, pre, A, B;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lld%lld", &a[i].pos, &a[i].l);
  sort(a + 1, a + n + 1);
  a[0].pos = -INF;
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= i; j++)
      for (int k = 0; k < 2; k++) {
        ans = max(ans, f[i][j][k]);
        mx = -INF;
        A = B = 0;
        pre = a[j].pos + k * a[j].l;
        for (int jj = i + 1; jj <= n; jj++)
          for (int kk = 0; kk < 2; kk++) {
            to = a[jj].pos + a[jj].l * kk;
            if (to > mx) mx = to, A = jj, B = kk;
            f[jj][A][B] =
                max(f[jj][A][B], f[i][j][k] + min(a[jj].l, to - pre) + mx - to);
          }
      }
  printf("%lld\n", ans);
  return 0;
}
