#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool checkMax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
template <class T>
inline bool checkMin(T &a, const T &b) {
  return a > b ? a = b, 1 : 0;
}
const int INF = 0x3f3f3f3f;
const long long llINF = 1e18;
const int MAXN = 105;
const int MAXM = MAXN * 3;
int n, tot;
int b[MAXM], f[MAXN][MAXM], g[MAXM];
struct Seg {
  int p, l, r;
} a[MAXN];
bool cmp(const Seg &x, const Seg &y) { return x.p < y.p; }
int main() {
  scanf("%d", &n);
  for (int i = 1, len; i <= n; i++) {
    scanf("%d%d", &a[i].p, &len);
    a[i].l = a[i].p - len;
    a[i].r = a[i].p + len;
    b[++tot] = a[i].p;
    b[++tot] = a[i].l;
    b[++tot] = a[i].r;
  }
  sort(a + 1, a + 1 + n, cmp);
  sort(b + 1, b + 1 + tot);
  tot = unique(b + 1, b + 1 + tot) - b - 1;
  for (int i = 1; i <= n; i++) {
    a[i].l = lower_bound(b + 1, b + 1 + tot, a[i].l) - b;
    a[i].p = lower_bound(b + 1, b + 1 + tot, a[i].p) - b;
    a[i].r = lower_bound(b + 1, b + 1 + tot, a[i].r) - b;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= tot; j++) g[j] = 0;
    for (int j = 1; j <= tot; j++) f[i][j] = f[i - 1][j];
    int p = a[i].p, l = a[i].l, r = a[i].r;
    int R = p;
    g[R] = f[i - 1][l] + b[R] - b[l];
    for (int j = i - 1; j >= 1; j--) {
      checkMax(R, a[j].r);
      checkMax(g[R], f[j - 1][l] + b[R] - b[l]);
    }
    for (int j = tot; j >= l; j--) {
      checkMax(f[i][j], g[j]);
      checkMax(g[j - 1], g[j] - (b[j] - b[j - 1]));
    }
    for (int j = p; j <= r; j++) checkMax(f[i][j], f[i - 1][p] + b[j] - b[p]);
    for (int j = 1; j <= tot; j++) checkMax(f[i][j], f[i][j - 1]);
  }
  printf("%d\n", f[n][tot]);
  return 0;
}
