#include <bits/stdc++.h>
using namespace std;
const long long N = 105;
struct node {
  long long p, l, r;
  bool operator<(node a) const { return p < a.p; }
} a[N];
long long n, tot, ans;
long long b[N * 3], f[N][N * 3], tmp[N * 3];
signed main() {
  scanf("%lld", &n);
  for (long long i = 1; i <= n; i++)
    scanf("%lld%lld", &a[i].p, &a[i].l), a[i].r = a[i].p + a[i].l,
                                         a[i].l = a[i].p - a[i].l;
  for (long long i = 1; i <= n; i++)
    b[++tot] = a[i].p, b[++tot] = a[i].l, b[++tot] = a[i].r;
  sort(a + 1, a + n + 1);
  sort(b + 1, b + tot + 1);
  tot = unique(b + 1, b + tot + 1) - b - 1;
  for (long long i = 1; i <= n; i++) {
    a[i].l = lower_bound(b + 1, b + tot + 1, a[i].l) - b;
    a[i].p = lower_bound(b + 1, b + tot + 1, a[i].p) - b;
    a[i].r = lower_bound(b + 1, b + tot + 1, a[i].r) - b;
  }
  for (long long i = 1; i <= n; i++) {
    long long p = a[i].p, l = a[i].l, r = a[i].r, mr = p;
    for (long long j = 0; j <= tot; j++) tmp[j] = 0;
    for (long long j = 0; j <= tot; j++) f[i][j] = f[i - 1][j];
    for (long long j = i - 1; j; j--) {
      tmp[mr] = max(tmp[mr], f[j][l] + b[mr] - b[l]);
      mr = max(mr, a[j].r);
    }
    tmp[mr] = max(tmp[mr], b[mr] - b[l]);
    for (long long j = tot; j >= l; j--) {
      f[i][j] = max(f[i][j], tmp[j]);
      tmp[j - 1] = max(tmp[j - 1], tmp[j] - (b[j] - b[j - 1]));
    }
    for (long long j = p; j <= r; j++)
      f[i][j] = max(f[i][j], f[i - 1][p] + b[j] - b[p]);
    for (long long j = 1; j <= tot; j++) f[i][j] = max(f[i][j], f[i][j - 1]);
  }
  printf("%lld\n", f[n][tot]);
}
