#include <bits/stdc++.h>
using namespace std;
const int N = 105, M = 505;
struct node {
  int l, m, r;
  bool operator<(const node x) const { return m < x.m; }
} a[N];
int f[N][M], g[M], h1[N][M], h2[N][M], n, v[M], mx[N][N], t, ans;
inline int chmax(int& x, int y) { x = (x > y ? x : y); }
void upd(int i) {
  for (int k = 1; k <= t; ++k)
    g[k] = max(g[k], f[i][k]), h1[i][k] = max(h1[i][k - 1], f[i][k]);
  for (int k = t; k; --k) h2[i][k] = max(h2[i][k + 1], f[i][k] - v[k]);
}
int main() {
  scanf("%d", &n);
  v[++t] = -1e9;
  for (int i = 1, x; i <= n; ++i) {
    scanf("%d%d", &a[i].m, &x);
    a[i].l = a[i].m - x, a[i].r = a[i].m + x;
    v[++t] = a[i].l, v[++t] = a[i].m, v[++t] = a[i].r;
  }
  sort(v + 1, v + 1 + t), t = unique(v + 1, v + 1 + t) - v - 1;
  for (int i = 1; i <= n; ++i)
    a[i].l = lower_bound(v + 1, v + 1 + t, a[i].l) - v,
    a[i].m = lower_bound(v + 1, v + 1 + t, a[i].m) - v,
    a[i].r = lower_bound(v + 1, v + 1 + t, a[i].r) - v;
  sort(a + 1, a + 1 + n);
  for (int i = 1; i <= n; ++i) {
    mx[i][i] = a[i].r;
    for (int j = i + 1; j <= n; ++j) mx[i][j] = max(mx[i][j - 1], a[j].r);
  }
  memset(f, -0x3f, sizeof(f)), memset(g, -0x3f, sizeof(g)),
      memset(h1, -0x3f, sizeof(h1)), memset(h2, -0x3f, sizeof(h2));
  f[0][1] = 0, upd(0);
  for (int i = 1; i <= n; ++i) {
    for (int k = 1; k <= t; ++k)
      chmax(f[i][max(a[i].r, k)],
            g[k] + max(0, min(v[a[i].r] - v[k], v[a[i].r] - v[a[i].m])));
    for (int j = 0; j < i; ++j)
      chmax(f[i][max(a[i].m, mx[j + 1][i - 1])],
            max(h1[j][a[i].l] - v[a[i].l], h2[j][a[i].l + 1]) +
                max(v[a[i].m], v[mx[j + 1][i - 1]]));
    upd(i);
  }
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= t; ++j) chmax(ans, f[i][j]);
  printf("%d\n", ans);
}
